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>
}
isChannel
channelIsMine={channelIsMine}
/>
) : (
<section className="main--empty">{__("This channel hasn't published anything yet")}</section>

View file

@ -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 && <div className="empty main--empty">{empty || noResultMsg}</div>}

View file

@ -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<string>,
channel_ids?: Array<string>,
claim_ids?: Array<string>,
not_channel_ids: Array<string>,
not_channel_ids?: Array<string>,
order_by: Array<string>,
release_time?: 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
// 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 && (
<div className="claim-grid">

View file

@ -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),
});

View file

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

View file

@ -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) {
<UriIndicator uri={uri} />
</div>
)}
<ClaimMenuList uri={uri} />
<ClaimMenuList uri={uri} channelIsMine={channelIsMine} isRepost={isRepost} />
</h2>
</NavLink>
<div>