From f0da60719df9d7600d8136f4f5eca92df2575ea6 Mon Sep 17 00:00:00 2001 From: infinite-persistence <64950861+infinite-persistence@users.noreply.github.com> Date: Thu, 24 Aug 2023 22:54:14 +0800 Subject: [PATCH] Hide comments from deleted channels (#2940) * Remove unused prop * Hide comments from deleted channels ## Ticket 2934 comments for deleted channel still shown ## Old behavior - `UriIndicator` will display the deleted channel name as "[Removed]". - Comment text remains displayed. ## Root cause 2554 (1f60d017) removed `UriIndicator` and tries to display the best channel name format based on `comment` object data, which is populated even if the channel was deleted. ## Change I think there was a reason why we decided to show the comment instead of hiding it, but I can't recall. Maybe it's so that the Total shown tallies, or some pagination issue. Anyway, just hide it for now as suggested in the ticket. If an issue is found, we can try to restore the old behavior. --- ui/component/comment/index.js | 2 +- ui/component/comment/view.jsx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ui/component/comment/index.js b/ui/component/comment/index.js index db121178ed..248b91be7e 100644 --- a/ui/component/comment/index.js +++ b/ui/component/comment/index.js @@ -46,10 +46,10 @@ const select = (state, props) => { claim, commentingEnabled: Boolean(selectUserVerifiedEmail(state)), othersReacts: selectOthersReactsForComment(state, reactionKey), - activeChannelClaim, hasChannels: selectHasChannels(state), playingUri: selectPlayingUri(state), stakedLevel: selectStakedLevelForChannelUri(state, channel_url), + isCommenterChannelDeleted: selectClaimForUri(state, channel_url) === null, linkedCommentAncestors: selectFetchedCommentAncestors(state), totalReplyPages: makeSelectTotalReplyPagesForParentId(comment_id)(state), odyseeMembership: selectOdyseeMembershipForChannelId(state, channel_id) || '', diff --git a/ui/component/comment/view.jsx b/ui/component/comment/view.jsx index 39231fdc97..960734781a 100644 --- a/ui/component/comment/view.jsx +++ b/ui/component/comment/view.jsx @@ -77,7 +77,6 @@ type StateProps = {| linkedCommentAncestors: { [string]: Array }, totalReplyPages: number, repliesFetching: boolean, - activeChannelClaim: ?ChannelClaim, claim: StreamClaim, authorTitle: ?string, channelAge?: any, @@ -88,6 +87,7 @@ type StateProps = {| commentingEnabled: boolean, playingUri: PlayingUri, stakedLevel: number, + isCommenterChannelDeleted: boolean, |}; type DispatchProps = {| @@ -125,6 +125,7 @@ function CommentView(props: Props & StateProps & DispatchProps) { othersReacts, playingUri, stakedLevel, + isCommenterChannelDeleted, supportDisabled, setQuickReply, quickReply, @@ -309,6 +310,10 @@ function CommentView(props: Props & StateProps & DispatchProps) { [ROUGH_HEADER_HEIGHT, isMobile] ); + if (isCommenterChannelDeleted) { + return null; + } + return (