add selector for nsfw tags
This commit is contained in:
parent
5f0fd9e9a5
commit
8629f10765
4 changed files with 35 additions and 2 deletions
17
dist/bundle.es.js
vendored
17
dist/bundle.es.js
vendored
|
@ -1128,7 +1128,8 @@ const isClaimNsfw = claim => {
|
||||||
|
|
||||||
const tags = claim.value.tags || [];
|
const tags = claim.value.tags || [];
|
||||||
for (let i = 0; i < tags.length; i += 1) {
|
for (let i = 0; i < tags.length; i += 1) {
|
||||||
if (naughtyTags[tags[i]]) {
|
const tag = tags[i].toLowerCase();
|
||||||
|
if (naughtyTags[tag]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1319,6 +1320,19 @@ const makeSelectNsfwCountForChannel = uri => reselect.createSelector(selectClaim
|
||||||
}, 0);
|
}, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const makeSelectClaimIsNsfw = uri => reselect.createSelector(makeSelectClaimForUri(uri),
|
||||||
|
// Eventually these will come from some list of tags that are considered adult
|
||||||
|
// Or possibly come from users settings of what tags they want to hide
|
||||||
|
// For now, there is just a hard coded list of tags inside `isClaimNsfw`
|
||||||
|
// selectNaughtyTags(),
|
||||||
|
claim => {
|
||||||
|
if (!claim) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isClaimNsfw(claim);
|
||||||
|
});
|
||||||
|
|
||||||
const makeSelectRecommendedContentForUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), selectSearchUrisByQuery, (claim, searchUrisByQuery) => {
|
const makeSelectRecommendedContentForUri = uri => reselect.createSelector(makeSelectClaimForUri(uri), selectSearchUrisByQuery, (claim, searchUrisByQuery) => {
|
||||||
const atVanityURI = !uri.includes('#');
|
const atVanityURI = !uri.includes('#');
|
||||||
|
|
||||||
|
@ -3462,6 +3476,7 @@ exports.makeSelectBlockDate = makeSelectBlockDate;
|
||||||
exports.makeSelectChannelForClaimUri = makeSelectChannelForClaimUri;
|
exports.makeSelectChannelForClaimUri = makeSelectChannelForClaimUri;
|
||||||
exports.makeSelectClaimForUri = makeSelectClaimForUri;
|
exports.makeSelectClaimForUri = makeSelectClaimForUri;
|
||||||
exports.makeSelectClaimIsMine = makeSelectClaimIsMine;
|
exports.makeSelectClaimIsMine = makeSelectClaimIsMine;
|
||||||
|
exports.makeSelectClaimIsNsfw = makeSelectClaimIsNsfw;
|
||||||
exports.makeSelectClaimIsPending = makeSelectClaimIsPending;
|
exports.makeSelectClaimIsPending = makeSelectClaimIsPending;
|
||||||
exports.makeSelectClaimsInChannelForCurrentPageState = makeSelectClaimsInChannelForCurrentPageState;
|
exports.makeSelectClaimsInChannelForCurrentPageState = makeSelectClaimsInChannelForCurrentPageState;
|
||||||
exports.makeSelectClaimsInChannelForPage = makeSelectClaimsInChannelForPage;
|
exports.makeSelectClaimsInChannelForPage = makeSelectClaimsInChannelForPage;
|
||||||
|
|
|
@ -117,6 +117,7 @@ export {
|
||||||
makeSelectTotalPagesForChannel,
|
makeSelectTotalPagesForChannel,
|
||||||
makeSelectNsfwCountFromUris,
|
makeSelectNsfwCountFromUris,
|
||||||
makeSelectNsfwCountForChannel,
|
makeSelectNsfwCountForChannel,
|
||||||
|
makeSelectClaimIsNsfw,
|
||||||
makeSelectRecommendedContentForUri,
|
makeSelectRecommendedContentForUri,
|
||||||
makeSelectFirstRecommendedFileForUri,
|
makeSelectFirstRecommendedFileForUri,
|
||||||
makeSelectChannelForClaimUri,
|
makeSelectChannelForClaimUri,
|
||||||
|
|
|
@ -331,6 +331,22 @@ export const makeSelectNsfwCountForChannel = (uri: string) =>
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export const makeSelectClaimIsNsfw = (uri: string): boolean =>
|
||||||
|
createSelector(
|
||||||
|
makeSelectClaimForUri(uri),
|
||||||
|
// Eventually these will come from some list of tags that are considered adult
|
||||||
|
// Or possibly come from users settings of what tags they want to hide
|
||||||
|
// For now, there is just a hard coded list of tags inside `isClaimNsfw`
|
||||||
|
// selectNaughtyTags(),
|
||||||
|
(claim: StreamClaim) => {
|
||||||
|
if (!claim) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return isClaimNsfw(claim);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
export const makeSelectRecommendedContentForUri = (uri: string) =>
|
export const makeSelectRecommendedContentForUri = (uri: string) =>
|
||||||
createSelector(
|
createSelector(
|
||||||
makeSelectClaimForUri(uri),
|
makeSelectClaimForUri(uri),
|
||||||
|
|
|
@ -16,7 +16,8 @@ export const isClaimNsfw = (claim: StreamClaim): boolean => {
|
||||||
|
|
||||||
const tags = claim.value.tags || [];
|
const tags = claim.value.tags || [];
|
||||||
for (let i = 0; i < tags.length; i += 1) {
|
for (let i = 0; i < tags.length; i += 1) {
|
||||||
if (naughtyTags[tags[i]]) {
|
const tag = tags[i].toLowerCase();
|
||||||
|
if (naughtyTags[tag]) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue