Fix 'freshness' filter not working in Category Pages

## Issue
Ticket: 1484

The commit `7622e7a: Fix release time on category pages` passes in the `releaseTime` prop, which usually means we want that value to be override.

## Change
Only pass the prop when there 'freshness' filter is not active.
This commit is contained in:
infinite-persistence 2022-05-12 15:16:03 +08:00
parent 123496e734
commit c4f88ac7e8
No known key found for this signature in database
GPG key ID: B9C3252EDC3D0AA0

View file

@ -63,6 +63,8 @@ function DiscoverPage(props: Props) {
const langParam = urlParams.get(CS.LANGUAGE_KEY) || null; const langParam = urlParams.get(CS.LANGUAGE_KEY) || null;
const claimType = urlParams.get('claim_type'); const claimType = urlParams.get('claim_type');
const tagsQuery = urlParams.get('t') || null; const tagsQuery = urlParams.get('t') || null;
const freshnessParam = urlParams.get(CS.FRESH_KEY);
const orderParam = urlParams.get(CS.ORDER_BY_KEY);
const tags = tagsQuery ? tagsQuery.split(',') : null; const tags = tagsQuery ? tagsQuery.split(',') : null;
const repostedClaimIsResolved = repostedUri && repostedClaim; const repostedClaimIsResolved = repostedUri && repostedClaim;
const hideRepostRibbon = isCategory && !isWildWest; const hideRepostRibbon = isCategory && !isWildWest;
@ -185,11 +187,18 @@ function DiscoverPage(props: Props) {
); );
} }
let releaseTime = dynamicRouteProps?.options?.releaseTime; const categoryReleaseTime = dynamicRouteProps?.options?.releaseTime;
let releaseTime;
if (isWildWest) { if (isWildWest) {
// The homepage definition currently does not support 'start-of-week', so // The homepage definition currently does not support 'start-of-week', so
// continue to hardcode here for now. // continue to hardcode here for now.
releaseTime = `>${Math.floor(moment().subtract(0, 'hour').startOf('week').unix())}`; releaseTime = `>${Math.floor(moment().subtract(0, 'hour').startOf('week').unix())}`;
} else if (categoryReleaseTime) {
const hasFreshnessOverride = orderParam === CS.ORDER_BY_TOP && freshnessParam !== null;
if (!hasFreshnessOverride) {
releaseTime = categoryReleaseTime;
}
} }
return ( return (