diff --git a/ui/component/commentsList/index.js b/ui/component/commentsList/index.js index 4b09b9b4f..c012096dc 100644 --- a/ui/component/commentsList/index.js +++ b/ui/component/commentsList/index.js @@ -4,7 +4,7 @@ import { makeSelectClaimForUri, makeSelectClaimIsMine, selectFetchingMyChannels, - selectMyChannelClaims, + selectMyClaimIdsRaw, } from 'redux/selectors/claims'; import { selectTopLevelCommentsForUri, @@ -35,7 +35,7 @@ const select = (state, props) => { return { topLevelComments, resolvedComments, - myChannels: selectMyChannelClaims(state), + myChannelIds: selectMyClaimIdsRaw(state), allCommentIds: makeSelectCommentIdsForUri(props.uri)(state), pinnedComments: selectPinnedCommentsForUri(state, props.uri), topLevelTotalPages: makeSelectTopLevelTotalPagesForUri(props.uri)(state), diff --git a/ui/component/commentsList/view.jsx b/ui/component/commentsList/view.jsx index 827d46fa8..c44b7a014 100644 --- a/ui/component/commentsList/view.jsx +++ b/ui/component/commentsList/view.jsx @@ -35,7 +35,7 @@ type Props = { uri: string, claim: ?Claim, claimIsMine: boolean, - myChannels: ?Array, + myChannelIds: ?Array, isFetchingComments: boolean, isFetchingCommentsById: boolean, isFetchingReacts: boolean, @@ -64,7 +64,7 @@ function CommentList(props: Props) { topLevelTotalPages, claim, claimIsMine, - myChannels, + myChannelIds, isFetchingComments, isFetchingReacts, linkedCommentId, @@ -256,9 +256,7 @@ function CommentList(props: Props) { message={comment.comment} timePosted={comment.timestamp * 1000} claimIsMine={claimIsMine} - commentIsMine={ - comment.channel_id && myChannels && myChannels.some(({ claim_id }) => claim_id === comment.channel_id) - } + commentIsMine={comment.channel_id && myChannelIds && myChannelIds.includes(comment.channel_id)} linkedCommentId={linkedCommentId} isPinned={comment.is_pinned} supportAmount={comment.support_amount} diff --git a/ui/component/livestreamComments/index.js b/ui/component/livestreamComments/index.js index 8325d74ef..f6c4cd3f5 100644 --- a/ui/component/livestreamComments/index.js +++ b/ui/component/livestreamComments/index.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import { selectClaimForUri, selectMyChannelClaims } from 'redux/selectors/claims'; +import { selectClaimForUri, selectMyClaimIdsRaw } from 'redux/selectors/claims'; import { doCommentSocketConnect, doCommentSocketDisconnect } from 'redux/actions/websocket'; import { doCommentList, doSuperChatList } from 'redux/actions/comments'; import { @@ -20,7 +20,7 @@ const select = (state, props) => ({ fetchingComments: selectIsFetchingComments(state), superChats: selectSuperChatsForUri(state, props.uri), superChatsTotalAmount: selectSuperChatTotalAmountForUri(state, props.uri), - myChannels: selectMyChannelClaims(state), + myChannelIds: selectMyClaimIdsRaw(state), }); export default connect(select, { diff --git a/ui/component/livestreamComments/view.jsx b/ui/component/livestreamComments/view.jsx index 33e22cdfc..e1313c74f 100644 --- a/ui/component/livestreamComments/view.jsx +++ b/ui/component/livestreamComments/view.jsx @@ -26,7 +26,7 @@ type Props = { fetchingComments: boolean, doSuperChatList: (string) => void, superChats: Array, - myChannels: ?Array, + myChannelIds: ?Array, }; const VIEW_MODE_CHAT = 'view_chat'; @@ -45,7 +45,7 @@ export default function LivestreamComments(props: Props) { doCommentList, fetchingComments, doSuperChatList, - myChannels, + myChannelIds, superChats: superChatsByTipAmount, } = props; @@ -152,14 +152,7 @@ export default function LivestreamComments(props: Props) { // todo: implement comment_list --mine in SDK so redux can grab with selectCommentIsMine function isMyComment(channelId: string) { - if (myChannels != null && channelId != null) { - for (let i = 0; i < myChannels.length; i++) { - if (myChannels[i].claim_id === channelId) { - return true; - } - } - } - return false; + return myChannelIds ? myChannelIds.includes(channelId) : false; } if (!claim) {