showNoSourceClaims

This commit is contained in:
zeppi 2021-07-06 17:19:19 -04:00
parent db0810e906
commit 376ccea82f
5 changed files with 18 additions and 9 deletions

View file

@ -1,5 +1,5 @@
// @flow
import { SHOW_ADS } from 'config';
import { SHOW_ADS, ENABLE_NO_SOURCE_CLAIMS } from 'config';
import * as CS from 'constants/claim_search';
import * as ICONS from 'constants/icons';
import React, { Fragment } from 'react';
@ -136,6 +136,7 @@ function ChannelContent(props: Props) {
{!channelIsMine && claimsInChannel > 0 && <HiddenNsfwClaims uri={uri} />}
<ClaimListDiscover
showNoSourceClaims={ENABLE_NO_SOURCE_CLAIMS}
defaultFreshness={CS.FRESH_ALL}
showHiddenByUser={viewHiddenChannels}
forceShowReposts

View file

@ -45,7 +45,7 @@ type Props = {
livestreamMap?: { [string]: any },
searchOptions?: any,
collectionId?: string,
hideLivestreamClaims?: boolean,
showNoSourceClaims?: boolean,
};
export default function ClaimList(props: Props) {
@ -77,7 +77,7 @@ export default function ClaimList(props: Props) {
livestreamMap,
searchOptions,
collectionId,
hideLivestreamClaims,
showNoSourceClaims,
} = props;
const [currentSort, setCurrentSort] = usePersistedState(persistedStorageKey, SORT_NEW);
@ -137,7 +137,7 @@ export default function ClaimList(props: Props) {
properties={renderProperties}
live={resolveLive(index)}
collectionId={collectionId}
hideLivestreamClaims={hideLivestreamClaims}
showNoSourceClaims={showNoSourceClaims}
/>
))}
{!timedOut && urisLength === 0 && !loading && <div className="empty main--empty">{empty || noResultMsg}</div>}
@ -198,7 +198,7 @@ export default function ClaimList(props: Props) {
showUserBlocked={showHiddenByUser}
showHiddenByUser={showHiddenByUser}
collectionId={collectionId}
hideLivestreamClaims={hideLivestreamClaims}
showNoSourceClaims={showNoSourceClaims}
customShouldHide={(claim: StreamClaim) => {
// Hack to hide spee.ch thumbnail publishes
// If it meets these requirements, it was probably uploaded here:

View file

@ -72,6 +72,7 @@ type Props = {
liveLivestreamsFirst?: boolean,
livestreamMap?: { [string]: any },
hasSource?: boolean,
showNoSourceClaims?: boolean,
isChannel?: boolean,
empty?: string,
};
@ -129,6 +130,7 @@ function ClaimListDiscover(props: Props) {
livestreamMap,
hasSource,
isChannel = false,
showNoSourceClaims,
empty,
} = props;
const didNavigateForward = history.action === 'PUSH';
@ -512,6 +514,7 @@ function ClaimListDiscover(props: Props) {
liveLivestreamsFirst={liveLivestreamsFirst}
livestreamMap={livestreamMap}
searchOptions={options}
showNoSourceClaims={showNoSourceClaims}
empty={empty}
/>
{loading && (
@ -546,6 +549,7 @@ function ClaimListDiscover(props: Props) {
liveLivestreamsFirst={liveLivestreamsFirst}
livestreamMap={livestreamMap}
searchOptions={options}
showNoSourceClaims={showNoSourceClaims}
empty={empty}
/>
{loading &&

View file

@ -44,6 +44,8 @@ type Props = {
properties?: (Claim) => void,
live?: boolean,
collectionId?: string,
showNoSourceClaims?: boolean,
isLivestream: boolean,
};
function ClaimPreviewTile(props: Props) {
@ -66,6 +68,8 @@ function ClaimPreviewTile(props: Props) {
showHiddenByUser,
properties,
live,
showNoSourceClaims,
isLivestream,
collectionId,
} = props;
const isRepost = claim && claim.repost_channel_url;
@ -149,7 +153,7 @@ function ClaimPreviewTile(props: Props) {
shouldHide = blockedChannelUris.some((blockedUri) => blockedUri === claim.permanent_url);
}
if (shouldHide) {
if (shouldHide || (isLivestream && !showNoSourceClaims)) {
return null;
}

View file

@ -37,7 +37,7 @@ export function prioritizeActiveLivestreams(
// for that channel actually point to the same source).
// 2. 'liveChannelIds' needs to be pruned after being accounted for,
// otherwise all livestream-claims will be "live" (we'll only take the
// latest one as "live").
// latest one as "live" ).
return (
claim &&
claim.value_type === 'stream' &&
@ -145,7 +145,7 @@ function ClaimTilesDiscover(props: Props) {
mutedUris,
liveLivestreamsFirst,
livestreamMap,
// pin,
// pin, // let's pin from /web folder
prefixUris,
} = props;
@ -240,7 +240,7 @@ function ClaimTilesDiscover(props: Props) {
const isLoading = fetchingClaimSearchByQuery[mainSearchKey];
if (liveLivestreamsFirst && livestreamMap) {
if (liveLivestreamsFirst && livestreamMap && !isLoading) {
prioritizeActiveLivestreams(uris, liveUris, livestreamMap, claimsByUri, claimSearchByQuery, options);
}