ChannelsFollowingDiscover: exclude followed channels

Note that there is a side effect of the channel going away immediately after Follow button is pressed. More elaborate code is needed like in the Following Manage page if we want the claim to be retained.
This commit is contained in:
infinite-persistence 2022-07-13 01:35:13 +08:00 committed by Thomas Zarebczan
parent 58d9605033
commit ecc6cb8a77

View file

@ -4,6 +4,7 @@ import Page from 'component/page';
import ClaimListDiscover from 'component/claimListDiscover'; import ClaimListDiscover from 'component/claimListDiscover';
import * as CS from 'constants/claim_search'; import * as CS from 'constants/claim_search';
import { CUSTOM_HOMEPAGE, SIMPLE_SITE } from 'config'; import { CUSTOM_HOMEPAGE, SIMPLE_SITE } from 'config';
import { parseClaimIdFromPermanentUrl } from 'util/url';
const MORE_CHANNELS_ANCHOR = 'MoreChannels'; const MORE_CHANNELS_ANCHOR = 'MoreChannels';
@ -15,7 +16,7 @@ type Props = {
}; };
function ChannelsFollowingDiscover(props: Props) { function ChannelsFollowingDiscover(props: Props) {
const { /* subscribedChannels, */ homepageData, discoverData } = props; const { subscribedChannels, homepageData, discoverData } = props;
const { PRIMARY_CONTENT, LATEST } = homepageData; const { PRIMARY_CONTENT, LATEST } = homepageData;
let channelIds; let channelIds;
@ -36,6 +37,7 @@ function ChannelsFollowingDiscover(props: Props) {
defaultFreshness={CS.FRESH_ALL} defaultFreshness={CS.FRESH_ALL}
claimType={CS.CLAIM_CHANNEL} claimType={CS.CLAIM_CHANNEL}
claimIds={CUSTOM_HOMEPAGE && channelIds ? channelIds : undefined} claimIds={CUSTOM_HOMEPAGE && channelIds ? channelIds : undefined}
excludedChannelIds={subscribedChannels.map((x) => parseClaimIdFromPermanentUrl(x.uri))}
scrollAnchor={MORE_CHANNELS_ANCHOR} scrollAnchor={MORE_CHANNELS_ANCHOR}
maxPages={SIMPLE_SITE ? 3 : undefined} maxPages={SIMPLE_SITE ? 3 : undefined}
hideFilters={SIMPLE_SITE} hideFilters={SIMPLE_SITE}