Remove triggerBlacklist
Since `triggerBlacklist` is just a simple boolean and `<Ads>` is not doing any additional logic on top of it, it doesn't make sense to pass as a parameter. Just not mount the component -- it's more concise and obvious at the client side.
This commit is contained in:
parent
1b0b9cad94
commit
e2f73a30c6
2 changed files with 3 additions and 8 deletions
|
@ -61,7 +61,7 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
|
|||
return false;
|
||||
}
|
||||
|
||||
const triggerBlacklist = React.useMemo(() => injectAds && claimContainsBlockedWords(claim), [injectAds, claim]);
|
||||
const blacklistTriggered = React.useMemo(() => injectAds && claimContainsBlockedWords(claim), [injectAds, claim]);
|
||||
|
||||
const [viewMode, setViewMode] = React.useState(VIEW_ALL_RELATED);
|
||||
const signingChannel = claim && claim.signing_channel;
|
||||
|
@ -133,9 +133,7 @@ export default React.memo<Props>(function RecommendedContent(props: Props) {
|
|||
loading={isSearching}
|
||||
uris={recommendedContentUris}
|
||||
hideMenu={isMobile}
|
||||
// TODO: Since 'triggerBlacklist' is handled by clients of <Ads> instead of internally by <Ads>, we don't
|
||||
// need that parameter and can just not mount it when 'true', instead of mount-then-hide.
|
||||
injectedItem={injectAds && <Ads small type={'video'} triggerBlacklist={triggerBlacklist} />}
|
||||
injectedItem={injectAds && !blacklistTriggered && <Ads small type={'video'} />}
|
||||
empty={__('No related content found')}
|
||||
onClick={handleRecommendationClicked}
|
||||
/>
|
||||
|
|
|
@ -42,7 +42,6 @@ type Props = {
|
|||
claim: Claim,
|
||||
isMature: boolean,
|
||||
authenticated: boolean,
|
||||
triggerBlacklist: boolean,
|
||||
};
|
||||
|
||||
function removeIfExists(querySelector) {
|
||||
|
@ -56,7 +55,6 @@ function Ads(props: Props) {
|
|||
type = 'video',
|
||||
small,
|
||||
authenticated,
|
||||
triggerBlacklist,
|
||||
} = props;
|
||||
|
||||
const shouldShowAds = SHOW_ADS && !authenticated;
|
||||
|
@ -140,8 +138,7 @@ function Ads(props: Props) {
|
|||
</div>
|
||||
);
|
||||
|
||||
// dont show if ads disabled on instance, blacklist word matched
|
||||
if (!SHOW_ADS || triggerBlacklist) {
|
||||
if (!SHOW_ADS) {
|
||||
return false;
|
||||
}
|
||||
// disable ads for firefox android because they don't work properly
|
||||
|
|
Loading…
Reference in a new issue