From d8c65c5bd3e9de579e28c4570edc61ac7f8b3282 Mon Sep 17 00:00:00 2001 From: jessop Date: Tue, 28 Jan 2020 16:33:35 -0500 Subject: [PATCH 1/2] support blocking mature recommended results if uri is not mature --- src/redux/selectors/claims.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/redux/selectors/claims.js b/src/redux/selectors/claims.js index 6adf368..8a93eb0 100644 --- a/src/redux/selectors/claims.js +++ b/src/redux/selectors/claims.js @@ -499,7 +499,8 @@ export const makeSelectRecommendedContentForUri = (uri: string) => createSelector( makeSelectClaimForUri(uri), selectSearchUrisByQuery, - (claim, searchUrisByQuery) => { + makeSelectClaimIsNsfw(uri), + (claim, searchUrisByQuery, isMature) => { const atVanityURI = !uri.includes('#'); let recommendedContent; @@ -513,9 +514,11 @@ export const makeSelectRecommendedContentForUri = (uri: string) => return; } - const searchQuery = getSearchQueryString(title.replace(/\//, ' '), undefined, undefined, { - related_to: claim.claim_id, - }); + const options = { related_to: claim.claim_id } + if (!isMature) { + options['nsfw'] = false; + } + const searchQuery = getSearchQueryString(title.replace(/\//, ' '), undefined, undefined, options); let searchUris = searchUrisByQuery[searchQuery]; if (searchUris) { From 71e85536dbe397df98a47a3c4b4311760b2e7419 Mon Sep 17 00:00:00 2001 From: jessop Date: Wed, 29 Jan 2020 14:20:59 -0500 Subject: [PATCH 2/2] rebase --- dist/bundle.es.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/bundle.es.js b/dist/bundle.es.js index 29c130f..7df3d24 100644 --- a/dist/bundle.es.js +++ b/dist/bundle.es.js @@ -2220,7 +2220,7 @@ claim => { return isClaimNsfw(claim); }); -const makeSelectRecommendedContentForUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), selectSearchUrisByQuery, (claim, searchUrisByQuery) => { +const makeSelectRecommendedContentForUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), selectSearchUrisByQuery, makeSelectClaimIsNsfw(uri), (claim, searchUrisByQuery, isMature) => { const atVanityURI = !uri.includes('#'); let recommendedContent; @@ -2234,9 +2234,11 @@ const makeSelectRecommendedContentForUri = uri => reselect.createSelector(makeSe return; } - const searchQuery = getSearchQueryString(title.replace(/\//, ' '), undefined, undefined, { - related_to: claim.claim_id - }); + const options = { related_to: claim.claim_id }; + if (!isMature) { + options['nsfw'] = false; + } + const searchQuery = getSearchQueryString(title.replace(/\//, ' '), undefined, undefined, options); let searchUris = searchUrisByQuery[searchQuery]; if (searchUris) {