add selectors for nsfw claim count

This commit is contained in:
Sean Yesmunt 2018-07-10 19:15:39 -04:00
parent 341db02c09
commit f466a5aa7f
4 changed files with 161 additions and 62 deletions

183
dist/bundle.js vendored
View file

@ -89,8 +89,8 @@ return /******/ (function(modules) { // webpackBootstrap
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.makeSelectBlockDate = exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectNavLinks = exports.selectActiveHistoryEntry = exports.selectHistoryStack = exports.selectHistoryIndex = exports.selectIsForwardDisabled = exports.selectIsBackDisabled = exports.selectPathAfterAuth = exports.selectPageTitle = exports.selectHeaderLinks = exports.selectCurrentParams = exports.selectCurrentPage = exports.selectCurrentPath = exports.makeSelectCurrentParam = exports.computePageFromPath = exports.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = undefined;
exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = exports.makeSelectFetchingCostInfoForUri = exports.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForPage = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectSnack = exports.selectNotificationProps = exports.selectNotification = exports.selectBlackListedOutpoints = exports.blacklistReducer = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doSendSupport = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doBlackListedOutpointsSubscribe = exports.doBlurSearchInput = exports.doFocusSearchInput = exports.doUpdateSearchQuery = exports.doSearch = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchRewardedContent = exports.doFetchTrendingUris = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doFetchClaimCountByChannel = exports.doFetchClaimsByChannel = exports.doHideNotification = exports.doNotify = exports.convertToShareLink = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.SETTINGS = exports.SEARCH_TYPES = exports.THUMBNAIL_STATUSES = exports.MODALS = exports.ACTIONS = exports.Notification = undefined;
exports.selectBlocks = exports.selectDraftTransactionError = exports.selectDraftTransactionAddress = exports.selectDraftTransactionAmount = exports.selectDraftTransaction = exports.selectGettingNewAddress = exports.selectReceiveAddress = exports.selectIsSendingSupport = exports.selectIsFetchingTransactions = exports.selectHasTransactions = exports.selectRecentTransactions = exports.selectTransactionItems = exports.selectTransactionsById = exports.selectBalance = exports.makeSelectBlockDate = exports.selectSearchBarFocused = exports.selectWunderBarAddress = exports.selectSearchUrisByQuery = exports.selectIsSearching = exports.selectSearchValue = exports.selectSearchQuery = exports.makeSelectSearchUris = exports.selectSearchState = exports.selectNavLinks = exports.selectActiveHistoryEntry = exports.selectHistoryStack = exports.selectHistoryIndex = exports.selectIsForwardDisabled = exports.selectIsBackDisabled = exports.selectPathAfterAuth = exports.selectPageTitle = exports.selectHeaderLinks = exports.selectCurrentParams = exports.selectCurrentPage = exports.selectCurrentPath = exports.makeSelectCurrentParam = exports.computePageFromPath = exports.selectSearchDownloadUris = exports.selectTotalDownloadProgress = exports.selectDownloadingFileInfos = exports.selectFileInfosDownloaded = exports.selectUrisLoading = exports.selectDownloadingByOutpoint = exports.selectIsFetchingFileListDownloadedOrPublished = exports.selectIsFetchingFileList = exports.selectFileInfosByOutpoint = exports.makeSelectLoadingForUri = exports.makeSelectDownloadingForUri = exports.makeSelectFileInfoForUri = exports.selectFetchingCostInfo = exports.selectCostForCurrentPageUri = exports.selectAllCostInfoByUri = exports.makeSelectCostInfoForUri = undefined;
exports.makeSelectFetchingCostInfoForUri = exports.selectRewardContentClaimIds = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.selectAllFetchingChannelClaims = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = exports.makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountFromUris = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.makeSelectIsUriResolving = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForPage = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.makeSelectClaimForUri = exports.selectSnack = exports.selectNotificationProps = exports.selectNotification = exports.selectBlackListedOutpoints = exports.blacklistReducer = exports.walletReducer = exports.searchReducer = exports.notificationsReducer = exports.fileInfoReducer = exports.costInfoReducer = exports.claimsReducer = exports.formatFullPrice = exports.formatCredits = exports.toQueryString = exports.parseQueryParams = exports.batchActions = exports.doSendSupport = exports.doSetDraftTransactionAddress = exports.doSetDraftTransactionAmount = exports.doSendDraftTransaction = exports.doCheckAddressIsMine = exports.doGetNewAddress = exports.doFetchBlock = exports.doFetchTransactions = exports.doBalanceSubscribe = exports.doUpdateBalance = exports.doBlackListedOutpointsSubscribe = exports.doBlurSearchInput = exports.doFocusSearchInput = exports.doUpdateSearchQuery = exports.doSearch = exports.doFetchFileInfosAndPublishedClaims = exports.doFileList = exports.doFetchFileInfo = exports.doFetchCostInfoForUri = exports.doFetchRewardedContent = exports.doFetchTrendingUris = exports.doFetchFeaturedUris = exports.doResolveUri = exports.doResolveUris = exports.doAbandonClaim = exports.doFetchClaimListMine = exports.doFetchClaimCountByChannel = exports.doFetchClaimsByChannel = exports.doHideNotification = exports.doNotify = exports.convertToShareLink = exports.isNameValid = exports.isURIClaimable = exports.isURIValid = exports.normalizeURI = exports.buildURI = exports.parseURI = exports.regexAddress = exports.regexInvalidURI = exports.Lbryapi = exports.Lbry = exports.SETTINGS = exports.SEARCH_TYPES = exports.THUMBNAIL_STATUSES = exports.MODALS = exports.ACTIONS = exports.Notification = undefined;
var _Notification = __webpack_require__(1);
@ -230,7 +230,7 @@ Object.defineProperty(exports, 'doFetchRewardedContent', {
}
});
var _cost_info = __webpack_require__(19);
var _cost_info = __webpack_require__(20);
Object.defineProperty(exports, 'doFetchCostInfoForUri', {
enumerable: true,
@ -239,7 +239,7 @@ Object.defineProperty(exports, 'doFetchCostInfoForUri', {
}
});
var _file_info = __webpack_require__(20);
var _file_info = __webpack_require__(21);
Object.defineProperty(exports, 'doFetchFileInfo', {
enumerable: true,
@ -260,7 +260,7 @@ Object.defineProperty(exports, 'doFetchFileInfosAndPublishedClaims', {
}
});
var _search = __webpack_require__(22);
var _search = __webpack_require__(23);
Object.defineProperty(exports, 'doSearch', {
enumerable: true,
@ -287,7 +287,7 @@ Object.defineProperty(exports, 'doBlurSearchInput', {
}
});
var _blacklist = __webpack_require__(26);
var _blacklist = __webpack_require__(27);
Object.defineProperty(exports, 'doBlackListedOutpointsSubscribe', {
enumerable: true,
@ -296,7 +296,7 @@ Object.defineProperty(exports, 'doBlackListedOutpointsSubscribe', {
}
});
var _wallet = __webpack_require__(27);
var _wallet = __webpack_require__(28);
Object.defineProperty(exports, 'doUpdateBalance', {
enumerable: true,
@ -359,7 +359,7 @@ Object.defineProperty(exports, 'doSendSupport', {
}
});
var _batchActions = __webpack_require__(18);
var _batchActions = __webpack_require__(19);
Object.defineProperty(exports, 'batchActions', {
enumerable: true,
@ -383,7 +383,7 @@ Object.defineProperty(exports, 'toQueryString', {
}
});
var _formatCredits = __webpack_require__(29);
var _formatCredits = __webpack_require__(30);
Object.defineProperty(exports, 'formatCredits', {
enumerable: true,
@ -398,7 +398,7 @@ Object.defineProperty(exports, 'formatFullPrice', {
}
});
var _claims2 = __webpack_require__(30);
var _claims2 = __webpack_require__(31);
Object.defineProperty(exports, 'claimsReducer', {
enumerable: true,
@ -407,7 +407,7 @@ Object.defineProperty(exports, 'claimsReducer', {
}
});
var _cost_info2 = __webpack_require__(31);
var _cost_info2 = __webpack_require__(32);
Object.defineProperty(exports, 'costInfoReducer', {
enumerable: true,
@ -416,7 +416,7 @@ Object.defineProperty(exports, 'costInfoReducer', {
}
});
var _file_info2 = __webpack_require__(32);
var _file_info2 = __webpack_require__(33);
Object.defineProperty(exports, 'fileInfoReducer', {
enumerable: true,
@ -425,7 +425,7 @@ Object.defineProperty(exports, 'fileInfoReducer', {
}
});
var _notifications2 = __webpack_require__(33);
var _notifications2 = __webpack_require__(34);
Object.defineProperty(exports, 'notificationsReducer', {
enumerable: true,
@ -434,7 +434,7 @@ Object.defineProperty(exports, 'notificationsReducer', {
}
});
var _search2 = __webpack_require__(35);
var _search2 = __webpack_require__(36);
Object.defineProperty(exports, 'searchReducer', {
enumerable: true,
@ -443,7 +443,7 @@ Object.defineProperty(exports, 'searchReducer', {
}
});
var _wallet2 = __webpack_require__(37);
var _wallet2 = __webpack_require__(38);
Object.defineProperty(exports, 'walletReducer', {
enumerable: true,
@ -452,7 +452,7 @@ Object.defineProperty(exports, 'walletReducer', {
}
});
var _blacklist2 = __webpack_require__(38);
var _blacklist2 = __webpack_require__(39);
Object.defineProperty(exports, 'blacklistReducer', {
enumerable: true,
@ -461,7 +461,7 @@ Object.defineProperty(exports, 'blacklistReducer', {
}
});
var _blacklist3 = __webpack_require__(39);
var _blacklist3 = __webpack_require__(40);
Object.defineProperty(exports, 'selectBlackListedOutpoints', {
enumerable: true,
@ -470,7 +470,7 @@ Object.defineProperty(exports, 'selectBlackListedOutpoints', {
}
});
var _notifications3 = __webpack_require__(40);
var _notifications3 = __webpack_require__(41);
Object.defineProperty(exports, 'selectNotification', {
enumerable: true,
@ -559,6 +559,18 @@ Object.defineProperty(exports, 'makeSelectTotalPagesForChannel', {
return _claims3.makeSelectTotalPagesForChannel;
}
});
Object.defineProperty(exports, 'makeSelectNsfwCountFromUris', {
enumerable: true,
get: function get() {
return _claims3.makeSelectNsfwCountFromUris;
}
});
Object.defineProperty(exports, 'makeSelectNsfwCountForChannel', {
enumerable: true,
get: function get() {
return _claims3.makeSelectNsfwCountForChannel;
}
});
Object.defineProperty(exports, 'selectClaimsById', {
enumerable: true,
get: function get() {
@ -698,7 +710,7 @@ Object.defineProperty(exports, 'selectRewardContentClaimIds', {
}
});
var _cost_info3 = __webpack_require__(41);
var _cost_info3 = __webpack_require__(42);
Object.defineProperty(exports, 'makeSelectFetchingCostInfoForUri', {
enumerable: true,
@ -731,7 +743,7 @@ Object.defineProperty(exports, 'selectFetchingCostInfo', {
}
});
var _file_info3 = __webpack_require__(21);
var _file_info3 = __webpack_require__(22);
Object.defineProperty(exports, 'makeSelectFileInfoForUri', {
enumerable: true,
@ -893,7 +905,7 @@ Object.defineProperty(exports, 'selectNavLinks', {
}
});
var _search3 = __webpack_require__(24);
var _search3 = __webpack_require__(25);
Object.defineProperty(exports, 'makeSelectSearchUris', {
enumerable: true,
@ -938,7 +950,7 @@ Object.defineProperty(exports, 'selectSearchBarFocused', {
}
});
var _wallet3 = __webpack_require__(28);
var _wallet3 = __webpack_require__(29);
Object.defineProperty(exports, 'makeSelectBlockDate', {
enumerable: true,
@ -1035,19 +1047,19 @@ var _action_types = __webpack_require__(4);
var ACTIONS = _interopRequireWildcard(_action_types);
var _modal_types = __webpack_require__(34);
var _modal_types = __webpack_require__(35);
var MODALS = _interopRequireWildcard(_modal_types);
var _thumbnail_upload_statuses = __webpack_require__(42);
var _thumbnail_upload_statuses = __webpack_require__(43);
var THUMBNAIL_STATUSES = _interopRequireWildcard(_thumbnail_upload_statuses);
var _search4 = __webpack_require__(23);
var _search4 = __webpack_require__(24);
var SEARCH_TYPES = _interopRequireWildcard(_search4);
var _settings = __webpack_require__(43);
var _settings = __webpack_require__(44);
var SETTINGS = _interopRequireWildcard(_settings);
@ -1650,7 +1662,7 @@ var _notifications = __webpack_require__(3);
var _claims = __webpack_require__(14);
var _batchActions = __webpack_require__(18);
var _batchActions = __webpack_require__(19);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@ -2869,7 +2881,7 @@ var objectKeys = Object.keys || function (obj) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.selectRewardContentClaimIds = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.makeSelectIsUriResolving = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectClaimsInChannelForPage = exports.makeSelectFetchingChannelClaims = exports.selectAllFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.makeSelectClaimForUri = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = undefined;
exports.makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountFromUris = exports.selectRewardContentClaimIds = exports.makeSelectTotalPagesForChannel = exports.makeSelectTotalItemsForChannel = exports.selectChannelClaimCounts = exports.selectPlayingUri = exports.selectFetchingTrendingUris = exports.selectTrendingUris = exports.selectFetchingFeaturedUris = exports.selectFeaturedUris = exports.makeSelectIsUriResolving = exports.selectResolvingUris = exports.selectMyChannelClaims = exports.selectFetchingMyChannels = exports.selectMyClaimsOutpoints = exports.selectAllMyClaimsByOutpoint = exports.selectMyClaimsWithoutChannels = exports.selectMyClaims = exports.selectPendingClaims = exports.selectIsFetchingClaimListMine = exports.makeSelectContentTypeForUri = exports.makeSelectTitleForUri = exports.makeSelectMetadataForUri = exports.makeSelectClaimsInChannelForCurrentPage = exports.makeSelectClaimsInChannelForPage = exports.makeSelectFetchingChannelClaims = exports.selectAllFetchingChannelClaims = exports.makeSelectClaimIsMine = exports.selectMyActiveClaims = exports.selectAbandoningIds = exports.selectMyClaimsRaw = exports.makeSelectClaimForUri = exports.selectAllClaimsByChannel = exports.selectClaimsByUri = exports.selectClaimsById = undefined;
var _lbryURI = __webpack_require__(2);
@ -2877,6 +2889,8 @@ var _navigation = __webpack_require__(15);
var _reselect = __webpack_require__(16);
var _claim = __webpack_require__(18);
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var selectState = function selectState(state) {
@ -3109,6 +3123,37 @@ var selectRewardContentClaimIds = exports.selectRewardContentClaimIds = (0, _res
return state.rewardedContentClaimIds;
});
var makeSelectNsfwCountFromUris = exports.makeSelectNsfwCountFromUris = function makeSelectNsfwCountFromUris(uris) {
return (0, _reselect.createSelector)(selectClaimsByUri, function (claims) {
return uris.reduce(function (acc, uri) {
var claim = claims[uri];
if ((0, _claim.isClaimNsfw)(claim)) {
return acc + 1;
}
return acc;
}, 0);
});
};
var makeSelectNsfwCountForChannel = exports.makeSelectNsfwCountForChannel = function makeSelectNsfwCountForChannel(uri) {
var pageSelector = (0, _navigation.makeSelectCurrentParam)('page');
return (0, _reselect.createSelector)(selectClaimsById, selectAllClaimsByChannel, pageSelector, function (byId, allClaims, page) {
var byChannel = allClaims[uri] || {};
var claimIds = byChannel[page || 1];
if (!claimIds) return 0;
return claimIds.reduce(function (acc, claimId) {
var claim = byId[claimId];
if ((0, _claim.isClaimNsfw)(claim)) {
return acc + 1;
}
return acc;
}, 0);
});
};
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
@ -3499,6 +3544,20 @@ function toQueryString(params) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var isClaimNsfw = exports.isClaimNsfw = function isClaimNsfw(claim) {
return claim && claim.value && claim.value.stream && claim.value.stream.metadata.nsfw;
};
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
@ -3516,7 +3575,7 @@ function batchActions() {
}
/***/ }),
/* 19 */
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -3576,7 +3635,7 @@ function doFetchCostInfoForUri(uri) {
}
/***/ }),
/* 20 */
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -3601,7 +3660,7 @@ var _claims = __webpack_require__(5);
var _claims2 = __webpack_require__(14);
var _file_info = __webpack_require__(21);
var _file_info = __webpack_require__(22);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@ -3669,7 +3728,7 @@ function doFetchFileInfosAndPublishedClaims() {
}
/***/ }),
/* 21 */
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -3876,7 +3935,7 @@ var selectSearchDownloadUris = exports.selectSearchDownloadUris = function selec
};
/***/ }),
/* 22 */
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -3891,7 +3950,7 @@ var _action_types = __webpack_require__(4);
var ACTIONS = _interopRequireWildcard(_action_types);
var _search = __webpack_require__(23);
var _search = __webpack_require__(24);
var SEARCH_TYPES = _interopRequireWildcard(_search);
@ -3899,11 +3958,11 @@ var _lbryURI = __webpack_require__(2);
var _claims = __webpack_require__(5);
var _search2 = __webpack_require__(24);
var _search2 = __webpack_require__(25);
var _batchActions = __webpack_require__(18);
var _batchActions = __webpack_require__(19);
var _handleFetch = __webpack_require__(25);
var _handleFetch = __webpack_require__(26);
var _handleFetch2 = _interopRequireDefault(_handleFetch);
@ -4114,7 +4173,7 @@ var doBlurSearchInput = exports.doBlurSearchInput = function doBlurSearchInput()
};
/***/ }),
/* 23 */
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -4128,7 +4187,7 @@ var CHANNEL = exports.CHANNEL = 'channel';
var SEARCH = exports.SEARCH = 'search';
/***/ }),
/* 24 */
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -4186,7 +4245,7 @@ var selectSearchBarFocused = exports.selectSearchBarFocused = (0, _reselect.crea
});
/***/ }),
/* 25 */
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -4201,7 +4260,7 @@ function handleFetchResponse(response) {
}
/***/ }),
/* 26 */
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -4284,7 +4343,7 @@ function doBlackListedOutpointsSubscribe() {
}
/***/ }),
/* 27 */
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -4314,7 +4373,7 @@ var _lbry2 = _interopRequireDefault(_lbry);
var _notifications = __webpack_require__(3);
var _wallet = __webpack_require__(28);
var _wallet = __webpack_require__(29);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@ -4549,7 +4608,7 @@ function doSendSupport(amount, claimId, uri, successCallback, errorCallback) {
}
/***/ }),
/* 28 */
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -4685,7 +4744,7 @@ var makeSelectBlockDate = exports.makeSelectBlockDate = function makeSelectBlock
};
/***/ }),
/* 29 */
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -4723,7 +4782,7 @@ function formatFullPrice(amount) {
}
/***/ }),
/* 30 */
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5050,7 +5109,7 @@ function claimsReducer() {
}
/***/ }),
/* 31 */
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5108,7 +5167,7 @@ function costInfoReducer() {
}
/***/ }),
/* 32 */
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5305,7 +5364,7 @@ function fileInfoReducer() {
}
/***/ }),
/* 33 */
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5320,7 +5379,7 @@ var _action_types = __webpack_require__(4);
var ACTIONS = _interopRequireWildcard(_action_types);
var _modal_types = __webpack_require__(34);
var _modal_types = __webpack_require__(35);
var MODALS = _interopRequireWildcard(_modal_types);
@ -5391,7 +5450,7 @@ function notificationsReducer() {
}
/***/ }),
/* 34 */
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5427,7 +5486,7 @@ var CONFIRM_TRANSACTION = exports.CONFIRM_TRANSACTION = 'confirm_transaction';
var CONFIRM_THUMBNAIL_UPLOAD = exports.CONFIRM_THUMBNAIL_UPLOAD = 'confirm_thumbnail_upload';
/***/ }),
/* 35 */
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5447,7 +5506,7 @@ var _action_types = __webpack_require__(4);
var ACTIONS = _interopRequireWildcard(_action_types);
var _reduxUtils = __webpack_require__(36);
var _reduxUtils = __webpack_require__(37);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
@ -5551,7 +5610,7 @@ var searchReducer = exports.searchReducer = (0, _reduxUtils.handleActions)((_han
}), _handleActions), defaultState);
/***/ }),
/* 36 */
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5584,7 +5643,7 @@ var handleActions = exports.handleActions = function handleActions(actionMap, de
};
/***/ }),
/* 37 */
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5766,7 +5825,7 @@ function walletReducer() {
}
/***/ }),
/* 38 */
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5785,7 +5844,7 @@ var _action_types = __webpack_require__(4);
var ACTIONS = _interopRequireWildcard(_action_types);
var _reduxUtils = __webpack_require__(36);
var _reduxUtils = __webpack_require__(37);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
@ -5825,7 +5884,7 @@ var blacklistReducer = exports.blacklistReducer = (0, _reduxUtils.handleActions)
}), _handleActions), defaultState);
/***/ }),
/* 39 */
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5847,7 +5906,7 @@ var selectBlackListedOutpoints = exports.selectBlackListedOutpoints = (0, _resel
});
/***/ }),
/* 40 */
/* 41 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5887,7 +5946,7 @@ selectNotification, function (notification) {
});
/***/ }),
/* 41 */
/* 42 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5931,7 +5990,7 @@ var makeSelectFetchingCostInfoForUri = exports.makeSelectFetchingCostInfoForUri
};
/***/ }),
/* 42 */
/* 43 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@ -5947,7 +6006,7 @@ var COMPLETE = exports.COMPLETE = 'complete';
var MANUAL = exports.MANUAL = 'manual';
/***/ }),
/* 43 */
/* 44 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";

View file

@ -107,6 +107,8 @@ export {
makeSelectIsUriResolving,
makeSelectTotalItemsForChannel,
makeSelectTotalPagesForChannel,
makeSelectNsfwCountFromUris,
makeSelectNsfwCountForChannel,
selectClaimsById,
selectClaimsByUri,
selectAllClaimsByChannel,

View file

@ -1,6 +1,7 @@
import { normalizeURI } from 'lbryURI';
import { makeSelectCurrentParam } from 'redux/selectors/navigation';
import { createSelector } from 'reselect';
import { isClaimNsfw } from 'util/claim';
const selectState = state => state.claims || {};
@ -224,3 +225,38 @@ export const selectRewardContentClaimIds = createSelector(
selectState,
state => state.rewardedContentClaimIds
);
export const makeSelectNsfwCountFromUris = uris =>
createSelector(selectClaimsByUri, claims =>
uris.reduce((acc, uri) => {
const claim = claims[uri];
if (isClaimNsfw(claim)) {
return acc + 1;
}
return acc;
}, 0)
);
export const makeSelectNsfwCountForChannel = uri => {
const pageSelector = makeSelectCurrentParam('page');
return createSelector(
selectClaimsById,
selectAllClaimsByChannel,
pageSelector,
(byId, allClaims, page) => {
const byChannel = allClaims[uri] || {};
const claimIds = byChannel[page || 1];
if (!claimIds) return 0;
return claimIds.reduce((acc, claimId) => {
const claim = byId[claimId];
if (isClaimNsfw(claim)) {
return acc + 1;
}
return acc;
}, 0);
}
);
};

2
src/util/claim.js Normal file
View file

@ -0,0 +1,2 @@
export const isClaimNsfw = claim =>
claim && claim.value && claim.value.stream && claim.value.stream.metadata.nsfw;