Fix live chat

This commit is contained in:
Rafael 2022-03-03 12:16:02 -03:00 committed by Thomas Zarebczan
parent fea79d81fb
commit 5dd457d045
3 changed files with 13 additions and 5 deletions

View file

@ -151,7 +151,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, // @see: ui/constants/comments.js::SORT_BY sort_by?: ?number, // @see: ui/constants/comments.js::SORT_BY
}; };
declare type CommentListResponse = { declare type CommentListResponse = {

View file

@ -39,7 +39,14 @@ type Props = {
pinnedComments: Array<Comment>, pinnedComments: Array<Comment>,
superChats: Array<Comment>, superChats: Array<Comment>,
theme: string, theme: string,
doCommentList: (uri: string, parentId: string, page: number, pageSize: number) => void, doCommentList: (
uri: string,
parentId: ?string,
page: number,
pageSize: number,
sortBy: ?number,
isLivestream: boolean
) => void,
doResolveUris: (uris: Array<string>, cache: boolean) => void, doResolveUris: (uris: Array<string>, cache: boolean) => void,
doSuperChatList: (uri: string) => void, doSuperChatList: (uri: string) => void,
}; };
@ -147,7 +154,7 @@ export default function LivestreamChatLayout(props: Props) {
React.useEffect(() => { React.useEffect(() => {
if (claimId) { if (claimId) {
doCommentList(uri, '', 1, 75); doCommentList(uri, undefined, 1, 75, undefined, true);
doSuperChatList(uri); doSuperChatList(uri);
} }
}, [claimId, uri, doCommentList, doSuperChatList]); }, [claimId, uri, doCommentList, doSuperChatList]);

View file

@ -34,7 +34,8 @@ export function doCommentList(
parentId: ?string, parentId: ?string,
page: number = 1, page: number = 1,
pageSize: number = 99999, pageSize: number = 99999,
sortBy: number = SORT_BY.NEWEST sortBy: ?number = SORT_BY.NEWEST,
isLivestream?: boolean
) { ) {
return (dispatch: Dispatch, getState: GetState) => { return (dispatch: Dispatch, getState: GetState) => {
const state = getState(); const state = getState();
@ -84,7 +85,7 @@ export function doCommentList(
}; };
// Batch resolve comment channel urls // Batch resolve comment channel urls
if (commentChannelUrls) { if (commentChannelUrls && !isLivestream) {
const resolve = async () => await doResolveUris(commentChannelUrls, true); const resolve = async () => await doResolveUris(commentChannelUrls, true);
return resolve() return resolve()