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 <thomas.zarebczan@gmail.com>
This commit is contained in:
saltrafael 2021-05-15 02:53:56 -03:00 committed by GitHub
parent c85d7f12c8
commit 3131b48c77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 18 additions and 4 deletions

View file

@ -154,6 +154,8 @@ function ChannelContent(props: Props) {
/> />
</Form> </Form>
} }
isChannel
channelIsMine={channelIsMine}
/> />
) : ( ) : (
<section className="main--empty">{__("This channel hasn't published anything yet")}</section> <section className="main--empty">{__("This channel hasn't published anything yet")}</section>

View file

@ -44,6 +44,7 @@ type Props = {
liveLivestreamsFirst?: boolean, liveLivestreamsFirst?: boolean,
livestreamMap?: { [string]: any }, livestreamMap?: { [string]: any },
searchOptions?: any, searchOptions?: any,
channelIsMine: boolean,
}; };
export default function ClaimList(props: Props) { export default function ClaimList(props: Props) {
@ -74,6 +75,7 @@ export default function ClaimList(props: Props) {
liveLivestreamsFirst, liveLivestreamsFirst,
livestreamMap, livestreamMap,
searchOptions, searchOptions,
channelIsMine,
} = props; } = props;
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW); const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
@ -132,6 +134,7 @@ export default function ClaimList(props: Props) {
showHiddenByUser={showHiddenByUser} showHiddenByUser={showHiddenByUser}
properties={renderProperties} properties={renderProperties}
live={resolveLive(index)} live={resolveLive(index)}
channelIsMine={channelIsMine}
/> />
))} ))}
{!timedOut && urisLength === 0 && !loading && <div className="empty main--empty">{empty || noResultMsg}</div>} {!timedOut && urisLength === 0 && !loading && <div className="empty main--empty">{empty || noResultMsg}</div>}

View file

@ -72,6 +72,8 @@ type Props = {
liveLivestreamsFirst?: boolean, liveLivestreamsFirst?: boolean,
livestreamMap?: { [string]: any }, livestreamMap?: { [string]: any },
hasSource?: boolean, hasSource?: boolean,
isChannel?: boolean,
channelIsMine?: boolean,
}; };
function ClaimListDiscover(props: Props) { function ClaimListDiscover(props: Props) {
@ -126,6 +128,8 @@ function ClaimListDiscover(props: Props) {
liveLivestreamsFirst, liveLivestreamsFirst,
livestreamMap, livestreamMap,
hasSource, hasSource,
isChannel = false,
channelIsMine = false,
} = props; } = props;
const didNavigateForward = history.action === 'PUSH'; const didNavigateForward = history.action === 'PUSH';
const { search } = location; const { search } = location;
@ -202,7 +206,7 @@ function ClaimListDiscover(props: Props) {
not_tags: Array<string>, not_tags: Array<string>,
channel_ids?: Array<string>, channel_ids?: Array<string>,
claim_ids?: Array<string>, claim_ids?: Array<string>,
not_channel_ids: Array<string>, not_channel_ids?: Array<string>,
order_by: Array<string>, order_by: Array<string>,
release_time?: string, release_time?: string,
claim_type?: string | Array<string>, claim_type?: string | Array<string>,
@ -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 // 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 // it's faster, but we will need to remove it if we start using total_pages
no_totals: true, no_totals: true,
not_channel_ids: mutedAndBlockedChannelIds, not_channel_ids: isChannel ? undefined : mutedAndBlockedChannelIds,
not_tags: !showNsfw ? MATURE_TAGS : [], not_tags: !showNsfw ? MATURE_TAGS : [],
order_by: order_by:
orderParam === CS.ORDER_BY_TRENDING orderParam === CS.ORDER_BY_TRENDING
@ -508,6 +512,7 @@ function ClaimListDiscover(props: Props) {
liveLivestreamsFirst={liveLivestreamsFirst} liveLivestreamsFirst={liveLivestreamsFirst}
livestreamMap={livestreamMap} livestreamMap={livestreamMap}
searchOptions={options} searchOptions={options}
channelIsMine={channelIsMine}
/> />
{loading && ( {loading && (
<div className="claim-grid"> <div className="claim-grid">

View file

@ -8,7 +8,7 @@ import ClaimPreview from './view';
const select = (state, props) => ({ const select = (state, props) => ({
claim: makeSelectClaimForUri(props.uri)(state), 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), channelIsMuted: makeSelectChannelIsMuted(props.uri)(state),
channelIsBlocked: makeSelectChannelIsBlocked(props.uri)(state), channelIsBlocked: makeSelectChannelIsBlocked(props.uri)(state),
}); });

View file

@ -21,6 +21,8 @@ type Props = {
doToggleMuteChannel: (string) => void, doToggleMuteChannel: (string) => void,
doCommentModBlock: (string) => void, doCommentModBlock: (string) => void,
doCommentModUnBlock: (string) => void, doCommentModUnBlock: (string) => void,
channelIsMine: boolean,
isRepost: boolean,
}; };
function ClaimMenuList(props: Props) { function ClaimMenuList(props: Props) {

View file

@ -42,6 +42,7 @@ type Props = {
showHiddenByUser?: boolean, showHiddenByUser?: boolean,
properties?: (Claim) => void, properties?: (Claim) => void,
live?: boolean, live?: boolean,
channelIsMine?: boolean,
}; };
function ClaimPreviewTile(props: Props) { function ClaimPreviewTile(props: Props) {
@ -64,6 +65,7 @@ function ClaimPreviewTile(props: Props) {
showHiddenByUser, showHiddenByUser,
properties, properties,
live, live,
channelIsMine,
} = props; } = props;
const isRepost = claim && claim.repost_channel_url; const isRepost = claim && claim.repost_channel_url;
const shouldFetch = claim === undefined; const shouldFetch = claim === undefined;
@ -195,7 +197,7 @@ function ClaimPreviewTile(props: Props) {
<UriIndicator uri={uri} /> <UriIndicator uri={uri} />
</div> </div>
)} )}
<ClaimMenuList uri={uri} /> <ClaimMenuList uri={uri} channelIsMine={channelIsMine} isRepost={isRepost} />
</h2> </h2>
</NavLink> </NavLink>
<div> <div>