From 3131b48c772073695739ddd8ad281a614353f1ae Mon Sep 17 00:00:00 2001 From: saltrafael <76502841+saltrafael@users.noreply.github.com> Date: Sat, 15 May 2021 02:53:56 -0300 Subject: [PATCH] Fix blocking/muting issues on channel pages (#6034) * dont use no_channel_ids on channel content claim search * ClaimMenuList not filtering own content initially * fix errors Co-authored-by: Thomas Zarebczan --- ui/component/channelContent/view.jsx | 2 ++ ui/component/claimList/view.jsx | 3 +++ ui/component/claimListDiscover/view.jsx | 9 +++++++-- ui/component/claimMenuList/index.js | 2 +- ui/component/claimMenuList/view.jsx | 2 ++ ui/component/claimPreviewTile/view.jsx | 4 +++- 6 files changed, 18 insertions(+), 4 deletions(-) diff --git a/ui/component/channelContent/view.jsx b/ui/component/channelContent/view.jsx index b026bc2d9..10494a9a8 100644 --- a/ui/component/channelContent/view.jsx +++ b/ui/component/channelContent/view.jsx @@ -154,6 +154,8 @@ function ChannelContent(props: Props) { /> } + isChannel + channelIsMine={channelIsMine} /> ) : (
{__("This channel hasn't published anything yet")}
diff --git a/ui/component/claimList/view.jsx b/ui/component/claimList/view.jsx index 6c2a7c580..2931faeb2 100644 --- a/ui/component/claimList/view.jsx +++ b/ui/component/claimList/view.jsx @@ -44,6 +44,7 @@ type Props = { liveLivestreamsFirst?: boolean, livestreamMap?: { [string]: any }, searchOptions?: any, + channelIsMine: boolean, }; export default function ClaimList(props: Props) { @@ -74,6 +75,7 @@ export default function ClaimList(props: Props) { liveLivestreamsFirst, livestreamMap, searchOptions, + channelIsMine, } = props; const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW); @@ -132,6 +134,7 @@ export default function ClaimList(props: Props) { showHiddenByUser={showHiddenByUser} properties={renderProperties} live={resolveLive(index)} + channelIsMine={channelIsMine} /> ))} {!timedOut && urisLength === 0 && !loading &&
{empty || noResultMsg}
} diff --git a/ui/component/claimListDiscover/view.jsx b/ui/component/claimListDiscover/view.jsx index 382ba2adb..6867e627a 100644 --- a/ui/component/claimListDiscover/view.jsx +++ b/ui/component/claimListDiscover/view.jsx @@ -72,6 +72,8 @@ type Props = { liveLivestreamsFirst?: boolean, livestreamMap?: { [string]: any }, hasSource?: boolean, + isChannel?: boolean, + channelIsMine?: boolean, }; function ClaimListDiscover(props: Props) { @@ -126,6 +128,8 @@ function ClaimListDiscover(props: Props) { liveLivestreamsFirst, livestreamMap, hasSource, + isChannel = false, + channelIsMine = false, } = props; const didNavigateForward = history.action === 'PUSH'; const { search } = location; @@ -202,7 +206,7 @@ function ClaimListDiscover(props: Props) { not_tags: Array, channel_ids?: Array, claim_ids?: Array, - not_channel_ids: Array, + not_channel_ids?: Array, order_by: Array, release_time?: string, claim_type?: string | Array, @@ -221,7 +225,7 @@ function ClaimListDiscover(props: Props) { // no_totals makes it so the sdk doesn't have to calculate total number pages for pagination // it's faster, but we will need to remove it if we start using total_pages no_totals: true, - not_channel_ids: mutedAndBlockedChannelIds, + not_channel_ids: isChannel ? undefined : mutedAndBlockedChannelIds, not_tags: !showNsfw ? MATURE_TAGS : [], order_by: orderParam === CS.ORDER_BY_TRENDING @@ -508,6 +512,7 @@ function ClaimListDiscover(props: Props) { liveLivestreamsFirst={liveLivestreamsFirst} livestreamMap={livestreamMap} searchOptions={options} + channelIsMine={channelIsMine} /> {loading && (
diff --git a/ui/component/claimMenuList/index.js b/ui/component/claimMenuList/index.js index ecf82e7de..b90c9a695 100644 --- a/ui/component/claimMenuList/index.js +++ b/ui/component/claimMenuList/index.js @@ -8,7 +8,7 @@ import ClaimPreview from './view'; const select = (state, props) => ({ claim: makeSelectClaimForUri(props.uri)(state), - claimIsMine: makeSelectClaimIsMine(props.uri)(state), + claimIsMine: props.channelIsMine ? (props.isRepost ? makeSelectClaimIsMine(props.uri)(state) : true) : makeSelectClaimIsMine(props.uri)(state), channelIsMuted: makeSelectChannelIsMuted(props.uri)(state), channelIsBlocked: makeSelectChannelIsBlocked(props.uri)(state), }); diff --git a/ui/component/claimMenuList/view.jsx b/ui/component/claimMenuList/view.jsx index 2675d2318..85aaaa031 100644 --- a/ui/component/claimMenuList/view.jsx +++ b/ui/component/claimMenuList/view.jsx @@ -21,6 +21,8 @@ type Props = { doToggleMuteChannel: (string) => void, doCommentModBlock: (string) => void, doCommentModUnBlock: (string) => void, + channelIsMine: boolean, + isRepost: boolean, }; function ClaimMenuList(props: Props) { diff --git a/ui/component/claimPreviewTile/view.jsx b/ui/component/claimPreviewTile/view.jsx index e08984d9a..e3a365af8 100644 --- a/ui/component/claimPreviewTile/view.jsx +++ b/ui/component/claimPreviewTile/view.jsx @@ -42,6 +42,7 @@ type Props = { showHiddenByUser?: boolean, properties?: (Claim) => void, live?: boolean, + channelIsMine?: boolean, }; function ClaimPreviewTile(props: Props) { @@ -64,6 +65,7 @@ function ClaimPreviewTile(props: Props) { showHiddenByUser, properties, live, + channelIsMine, } = props; const isRepost = claim && claim.repost_channel_url; const shouldFetch = claim === undefined; @@ -195,7 +197,7 @@ function ClaimPreviewTile(props: Props) {
)} - +