Skip to content

Commit

Permalink
Use new param to remove sort-pins-first.
Browse files Browse the repository at this point in the history
comment.List currently always pushes pins to the top to support pagination. This new param removes this behavior.
  • Loading branch information
infinite-persistence committed Oct 1, 2021
1 parent 53ae7d0 commit 48247cb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion flow-typed/Comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ declare type CommentListParams = {
parent_id?: string, // filters comments to those under this thread
top_level?: boolean, // filters to only top level comments
hidden?: boolean, // if true, will show hidden comments as well
sort_by?: number, // NEWEST=0, OLDEST=1, CONTROVERSY=2, POPULARITY=3,
sort_by?: number, // @see: ui/constants/comments.js::SORT_BY
};

declare type CommentListResponse = {
Expand Down
1 change: 1 addition & 0 deletions ui/constants/comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const SORT_BY = {
OLDEST: 1,
CONTROVERSY: 2,
POPULARITY: 3,
NEWEST_NO_PINS: 4,
};

export const BLOCK_LEVEL = {
Expand Down
2 changes: 1 addition & 1 deletion ui/page/ownComments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const select = (state) => {

const perform = (dispatch) => ({
doCommentReset: (a) => dispatch(doCommentReset(a)),
doCommentListOwn: (a, b, c, d) => dispatch(doCommentListOwn(a, b, c, d)),
doCommentListOwn: (a, b, c) => dispatch(doCommentListOwn(a, b, c)),
});

export default connect(select, perform)(OwnComments);
6 changes: 3 additions & 3 deletions ui/page/ownComments/view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Card from 'component/common/card';
import Empty from 'component/common/empty';
import Page from 'component/page';
import Spinner from 'component/spinner';
import { SORT_BY, COMMENT_PAGE_SIZE_TOP_LEVEL } from 'constants/comment';
import { COMMENT_PAGE_SIZE_TOP_LEVEL } from 'constants/comment';
import * as ICONS from 'constants/icons';
import useFetched from 'effects/use-fetched';
import debounce from 'util/debounce';
Expand All @@ -29,7 +29,7 @@ type Props = {
isFetchingComments: boolean,
claimsById: any,
doCommentReset: (claimId: string) => void,
doCommentListOwn: (channelId: string, page: number, pageSize: number, sortBy: number) => void,
doCommentListOwn: (channelId: string, page: number, pageSize: number) => void,
};

export default function OwnComments(props: Props) {
Expand Down Expand Up @@ -117,7 +117,7 @@ export default function OwnComments(props: Props) {
// Fetch own comments
React.useEffect(() => {
if (page !== 0 && activeChannelId) {
doCommentListOwn(activeChannelId, page, COMMENT_PAGE_SIZE_TOP_LEVEL, SORT_BY.NEWEST);
doCommentListOwn(activeChannelId, page, COMMENT_PAGE_SIZE_TOP_LEVEL);
}
}, [page]); // eslint-disable-line react-hooks/exhaustive-deps

Expand Down
2 changes: 1 addition & 1 deletion ui/redux/actions/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export function doCommentListOwn(
channelId: string,
page: number = 1,
pageSize: number = 99999,
sortBy: number = SORT_BY.NEWEST
sortBy: number = SORT_BY.NEWEST_NO_PINS
) {
return async (dispatch: Dispatch, getState: GetState) => {
const state = getState();
Expand Down

0 comments on commit 48247cb

Please sign in to comment.