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 showNsfw = selectShowMatureContent(state);
const hideReposts = selectClientSetting(state, SETTINGS.HIDE_REPOSTS);
const forceShowReposts = props.forceShowReposts;
const mutedAndBlockedChannelIds = selectMutedAndBlockedChannelIds(state);
// 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);
return {
@ -71,6 +79,7 @@ function resolveSearchOptions(props) {
const {
showNsfw,
hideReposts,
forceShowReposts,
mutedAndBlockedChannelIds,
location,
pageSize,
@ -136,7 +145,7 @@ function resolveSearchOptions(props) {
}
// https://github.com/lbryio/lbry-desktop/issues/3774
if (hideReposts) {
if (hideReposts && !forceShowReposts) {
if (Array.isArray(options.claim_type)) {
options.claim_type = options.claim_type.filter((claimType) => claimType !== 'repost');
} else {

View file

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

View file

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

View file

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