List own comments #7171

Merged
infinite-persistence merged 7 commits from ip/own.comments into master 2021-10-01 14:10:27 +02:00
5 changed files with 7 additions and 6 deletions
Showing only changes of commit 48247cb097 - Show all commits

View file

@ -118,7 +118,7 @@ declare type CommentListParams = {
parent_id?: string, // filters comments to those under this thread parent_id?: string, // filters comments to those under this thread
top_level?: boolean, // filters to only top level comments top_level?: boolean, // filters to only top level comments
hidden?: boolean, // if true, will show hidden comments as well 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 = { declare type CommentListResponse = {

View file

@ -9,6 +9,7 @@ export const SORT_BY = {
OLDEST: 1, OLDEST: 1,
CONTROVERSY: 2, CONTROVERSY: 2,
POPULARITY: 3, POPULARITY: 3,
NEWEST_NO_PINS: 4,
}; };
export const BLOCK_LEVEL = { export const BLOCK_LEVEL = {

View file

@ -27,7 +27,7 @@ const select = (state) => {
const perform = (dispatch) => ({ const perform = (dispatch) => ({
doCommentReset: (a) => dispatch(doCommentReset(a)), 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); export default connect(select, perform)(OwnComments);

View file

@ -8,7 +8,7 @@ import Card from 'component/common/card';
import Empty from 'component/common/empty'; import Empty from 'component/common/empty';
import Page from 'component/page'; import Page from 'component/page';
import Spinner from 'component/spinner'; 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 * as ICONS from 'constants/icons';
import useFetched from 'effects/use-fetched'; import useFetched from 'effects/use-fetched';
import debounce from 'util/debounce'; import debounce from 'util/debounce';
@ -29,7 +29,7 @@ type Props = {
isFetchingComments: boolean, isFetchingComments: boolean,
claimsById: any, claimsById: any,
doCommentReset: (claimId: string) => void, 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) { export default function OwnComments(props: Props) {
@ -117,7 +117,7 @@ export default function OwnComments(props: Props) {
// Fetch own comments // Fetch own comments
React.useEffect(() => { React.useEffect(() => {
if (page !== 0 && activeChannelId) { 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 }, [page]); // eslint-disable-line react-hooks/exhaustive-deps

View file

@ -212,7 +212,7 @@ export function doCommentListOwn(
channelId: string, channelId: string,
page: number = 1, page: number = 1,
pageSize: number = 99999, pageSize: number = 99999,
sortBy: number = SORT_BY.NEWEST sortBy: number = SORT_BY.NEWEST_NO_PINS
) { ) {
return async (dispatch: Dispatch, getState: GetState) => { return async (dispatch: Dispatch, getState: GetState) => {
const state = getState(); const state = getState();