add makeSelectTagInClaimOrChannelForUri
This commit is contained in:
parent
3cb3859baf
commit
1fc5afa0c4
3 changed files with 35 additions and 4 deletions
7
dist/bundle.es.js
vendored
7
dist/bundle.es.js
vendored
|
@ -2575,6 +2575,12 @@ const makeSelectMyStreamUrlsForPage = (page = 1) => reselect.createSelector(sele
|
|||
|
||||
const selectMyStreamUrlsCount = reselect.createSelector(selectMyClaimUrisWithoutChannels, channels => channels.length);
|
||||
|
||||
const makeSelectTagInClaimOrChannelForUri = (uri, tag) => reselect.createSelector(makeSelectClaimForUri(uri), claim => {
|
||||
const claimTags = claim && claim.value && claim.value.tags || [];
|
||||
const channelTags = claim && claim.signing_channel && claim.signing_channel.value && claim.signing_channel.value.tags || [];
|
||||
return claimTags.includes(tag) || channelTags.includes(tag);
|
||||
});
|
||||
|
||||
function numberWithCommas(x) {
|
||||
var parts = x.toString().split('.');
|
||||
parts[0] = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||
|
@ -6319,6 +6325,7 @@ exports.makeSelectSearchDownloadUrlsForPage = makeSelectSearchDownloadUrlsForPag
|
|||
exports.makeSelectShortUrlForUri = makeSelectShortUrlForUri;
|
||||
exports.makeSelectStreamingUrlForUri = makeSelectStreamingUrlForUri;
|
||||
exports.makeSelectSupportsForUri = makeSelectSupportsForUri;
|
||||
exports.makeSelectTagInClaimOrChannelForUri = makeSelectTagInClaimOrChannelForUri;
|
||||
exports.makeSelectTagsForUri = makeSelectTagsForUri;
|
||||
exports.makeSelectThumbnailForUri = makeSelectThumbnailForUri;
|
||||
exports.makeSelectTitleForUri = makeSelectTitleForUri;
|
||||
|
|
|
@ -161,6 +161,7 @@ export {
|
|||
makeSelectDateForUri,
|
||||
makeSelectAmountForUri,
|
||||
makeSelectTagsForUri,
|
||||
makeSelectTagInClaimOrChannelForUri,
|
||||
makeSelectContentTypeForUri,
|
||||
makeSelectIsUriResolving,
|
||||
makeSelectTotalItemsForChannel,
|
||||
|
|
|
@ -680,6 +680,14 @@ export const makeSelectTagsForUri = (uri: string) =>
|
|||
}
|
||||
);
|
||||
|
||||
export const makeSelectChannelTagsForUri = (uri: string) =>
|
||||
createSelector(
|
||||
makeSelectMetadataForUri(uri),
|
||||
(metadata: ?GenericMetadata) => {
|
||||
return (metadata && metadata.tags) || [];
|
||||
}
|
||||
);
|
||||
|
||||
export const selectFetchingClaimSearchByQuery = createSelector(
|
||||
selectState,
|
||||
state => state.fetchingClaimSearchByQuery || {}
|
||||
|
@ -775,3 +783,18 @@ export const selectMyStreamUrlsCount = createSelector(
|
|||
selectMyClaimUrisWithoutChannels,
|
||||
channels => channels.length
|
||||
);
|
||||
|
||||
export const makeSelectTagInClaimOrChannelForUri = (uri: string, tag: string) =>
|
||||
createSelector(
|
||||
makeSelectClaimForUri(uri),
|
||||
claim => {
|
||||
const claimTags = (claim && claim.value && claim.value.tags) || [];
|
||||
const channelTags =
|
||||
(claim &&
|
||||
claim.signing_channel &&
|
||||
claim.signing_channel.value &&
|
||||
claim.signing_channel.value.tags) ||
|
||||
[];
|
||||
return claimTags.includes(tag) || channelTags.includes(tag);
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue