Force reposts in Homepage + Category Page, except Following & WW

Ticket: 1220
This commit is contained in:
infinite-persistence 2022-03-30 19:13:41 +08:00 committed by Thomas Zarebczan
parent 911ccaa07e
commit 1366f8d3ce
4 changed files with 15 additions and 2 deletions

View file

@ -18,10 +18,18 @@ import ClaimListDiscover from './view';
const select = (state, props) => { const select = (state, props) => {
const showNsfw = selectShowMatureContent(state); const showNsfw = selectShowMatureContent(state);
const hideReposts = selectClientSetting(state, SETTINGS.HIDE_REPOSTS); const hideReposts = selectClientSetting(state, SETTINGS.HIDE_REPOSTS);
const forceShowReposts = props.forceShowReposts;
const mutedAndBlockedChannelIds = selectMutedAndBlockedChannelIds(state); const mutedAndBlockedChannelIds = selectMutedAndBlockedChannelIds(state);
// TODO: memoize these 2 function calls. Lots of params, though; might not be feasible. // TODO: memoize these 2 function calls. Lots of params, though; might not be feasible.
const options = resolveSearchOptions({ showNsfw, hideReposts, mutedAndBlockedChannelIds, pageSize: 8, ...props }); const options = resolveSearchOptions({
showNsfw,
hideReposts,
forceShowReposts,
mutedAndBlockedChannelIds,
pageSize: 8,
...props,
});
const searchKey = createNormalizedClaimSearchKey(options); const searchKey = createNormalizedClaimSearchKey(options);
return { return {
@ -71,6 +79,7 @@ function resolveSearchOptions(props) {
const { const {
showNsfw, showNsfw,
hideReposts, hideReposts,
forceShowReposts,
mutedAndBlockedChannelIds, mutedAndBlockedChannelIds,
location, location,
pageSize, pageSize,
@ -136,7 +145,7 @@ function resolveSearchOptions(props) {
} }
// https://github.com/lbryio/lbry-desktop/issues/3774 // https://github.com/lbryio/lbry-desktop/issues/3774
if (hideReposts) { if (hideReposts && !forceShowReposts) {
if (Array.isArray(options.claim_type)) { if (Array.isArray(options.claim_type)) {
options.claim_type = options.claim_type.filter((claimType) => claimType !== 'repost'); options.claim_type = options.claim_type.filter((claimType) => claimType !== 'repost');
} else { } else {

View file

@ -46,6 +46,7 @@ type Props = {
limitClaimsPerChannel?: number, limitClaimsPerChannel?: number,
hasSource?: boolean, hasSource?: boolean,
hasNoSource?: boolean, hasNoSource?: boolean,
forceShowReposts?: boolean, // overrides SETTINGS.HIDE_REPOSTS
// --- select --- // --- select ---
location: { search: string }, location: { search: string },
claimSearchResults: Array<string>, claimSearchResults: Array<string>,
@ -68,6 +69,7 @@ function ClaimTilesDiscover(props: Props) {
fetchViewCount, fetchViewCount,
fetchingClaimSearch, fetchingClaimSearch,
hasNoSource, hasNoSource,
// forceShowReposts = false,
renderProperties, renderProperties,
pinUrls, pinUrls,
prefixUris, prefixUris,

View file

@ -215,6 +215,7 @@ function DiscoverPage(props: Props) {
} }
meta={getMeta()} meta={getMeta()}
hasSource hasSource
forceShowReposts={dynamicRouteProps}
/> />
</Page> </Page>
); );

View file

@ -166,6 +166,7 @@ function HomePage(props: Props) {
replace: adBlockerFound === false, replace: adBlockerFound === false,
} }
} }
forceShowReposts={id !== 'FOLLOWING'}
/> />
); );