From f21925beabbc895da93edea205ebb16e24c790f3 Mon Sep 17 00:00:00 2001 From: jessop Date: Thu, 21 Nov 2019 20:37:25 -0500 Subject: [PATCH 1/3] paginates over search count rather than channel claim count --- static/app-strings.json | 6 ++++-- ui/component/channelContent/index.js | 6 +++--- ui/component/channelContent/view.jsx | 9 ++++----- ui/redux/actions/content.js | 27 ++++++++++++++++++--------- 4 files changed, 29 insertions(+), 19 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index 1f436a49e..d3566cbf6 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -887,5 +887,7 @@ "with lbry.tv to receive notifications related to new content.": "with lbry.tv to receive notifications related to new content.", "An email was sent to %email%. Follow the link to %verify_text%. After, this page will update automatically.": "An email was sent to %email%. Follow the link to %verify_text%. After, this page will update automatically.", "Your email preferences": "Your email preferences", - "allow you to receive notifications related to new content.": "allow you to receive notifications related to new content." -} + "allow you to receive notifications related to new content.": "allow you to receive notifications related to new content.", + "files": "files", + "Invalid claim ID %claimId%.": "Invalid claim ID %claimId%." +} \ No newline at end of file diff --git a/ui/component/channelContent/index.js b/ui/component/channelContent/index.js index b61c63c87..ecb21183e 100644 --- a/ui/component/channelContent/index.js +++ b/ui/component/channelContent/index.js @@ -5,7 +5,7 @@ import { makeSelectClaimsInChannelForPage, makeSelectFetchingChannelClaims, makeSelectClaimIsMine, - makeSelectTotalPagesForChannel, + makeSelectTotalPagesInChannelSearch, selectChannelIsBlocked, } from 'lbry-redux'; import { withRouter } from 'react-router'; @@ -16,9 +16,9 @@ const select = (state, props) => { const urlParams = new URLSearchParams(search); const page = urlParams.get('page') || 0; return { - claimsInChannel: makeSelectClaimsInChannelForPage(props.uri, page)(state), + pageOfClaimsInChannel: makeSelectClaimsInChannelForPage(props.uri, page)(state), fetching: makeSelectFetchingChannelClaims(props.uri)(state), - totalPages: makeSelectTotalPagesForChannel(props.uri, PAGE_SIZE)(state), + totalPages: makeSelectTotalPagesInChannelSearch(props.uri, PAGE_SIZE)(state), channelIsMine: makeSelectClaimIsMine(props.uri)(state), channelIsBlocked: selectChannelIsBlocked(props.uri)(state), }; diff --git a/ui/component/channelContent/view.jsx b/ui/component/channelContent/view.jsx index f749a5cee..ac3adb447 100644 --- a/ui/component/channelContent/view.jsx +++ b/ui/component/channelContent/view.jsx @@ -12,7 +12,7 @@ type Props = { totalPages: number, fetching: boolean, params: { page: number }, - claimsInChannel: Array, + pageOfClaimsInChannel: Array, channelIsBlocked: boolean, channelIsMine: boolean, fetchClaims: (string, number) => void, @@ -23,15 +23,14 @@ function ChannelContent(props: Props) { const { uri, fetching, - claimsInChannel, + pageOfClaimsInChannel, totalPages, channelIsMine, channelIsBlocked, - fetchClaims, channelIsBlackListed, } = props; - const hasContent = Boolean(claimsInChannel && claimsInChannel.length); + const hasContent = Boolean(pageOfClaimsInChannel && pageOfClaimsInChannel.length); return ( {fetching && !hasContent && ( @@ -68,7 +67,7 @@ function ChannelContent(props: Props) { {!channelIsMine && } {hasContent && !channelIsBlocked && !channelIsBlackListed && ( - claim && claim.canonical_url)} /> + claim && claim.canonical_url)} /> )} {!channelIsBlocked && !channelIsBlackListed && ( diff --git a/ui/redux/actions/content.js b/ui/redux/actions/content.js index 668ae08b9..bf3897ec2 100644 --- a/ui/redux/actions/content.js +++ b/ui/redux/actions/content.js @@ -12,6 +12,7 @@ import { setSubscriptionLatest, doUpdateUnreadSubscriptions } from 'redux/action import { makeSelectUnreadByChannel } from 'redux/selectors/subscriptions'; import { ACTIONS, + MATURE_TAGS, Lbry, Lbryapi, makeSelectFileInfoForUri, @@ -137,21 +138,28 @@ export function doSetPlayingUri(uri: ?string) { } export function doFetchClaimsByChannel(uri: string, page: number = 1, pageSize: number = PAGE_SIZE) { - return (dispatch: Dispatch) => { - dispatch({ - type: ACTIONS.FETCH_CHANNEL_CLAIMS_STARTED, - data: { uri, page }, - }); - - Lbry.claim_search({ + return (dispatch: Dispatch, getState: GetState) => { + const state = getState(); + const showMature = makeSelectClientSetting(SETTINGS.SHOW_MATURE)(state); + const params = { channel: uri, page, page_size: pageSize, valid_channel_signature: true, order_by: ['release_time'], - }).then(result => { - const { items: claims, total_items: claimsInChannel, page: returnedPage } = result; + }; + if (!showMature) { + params['not_tags'] = MATURE_TAGS; + } + + dispatch({ + type: ACTIONS.FETCH_CHANNEL_CLAIMS_STARTED, + data: { uri, page }, + }); + + Lbry.claim_search(params).then(result => { + const { items: claims, page: returnedPage, total_items: claimsInChannel, total_pages: pageTotal } = result; if (claims && claims.length) { if (page === 1) { const latest = claims[0]; @@ -174,6 +182,7 @@ export function doFetchClaimsByChannel(uri: string, page: number = 1, pageSize: claimsInChannel, claims: claims || [], page: returnedPage || undefined, + totalPages: pageTotal, }, }); }); -- 2.43.4 From 29ab7fe4e7e11f77603a376ad81dc87c4e9d2c58 Mon Sep 17 00:00:00 2001 From: jessop Date: Mon, 25 Nov 2019 15:13:19 -0500 Subject: [PATCH 2/3] fixes hidden claims notification --- ui/component/hiddenNsfwClaims/index.js | 12 ++++++------ ui/component/hiddenNsfwClaims/view.jsx | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ui/component/hiddenNsfwClaims/index.js b/ui/component/hiddenNsfwClaims/index.js index 9b15d00d2..8121bd0a2 100644 --- a/ui/component/hiddenNsfwClaims/index.js +++ b/ui/component/hiddenNsfwClaims/index.js @@ -1,23 +1,23 @@ import { connect } from 'react-redux'; -import { makeSelectNsfwCountForChannel, makeSelectNsfwCountFromUris, parseURI } from 'lbry-redux'; +import { makeSelectNsfwCountFromUris, makeSelectOmittedCountForChannel, parseURI } from 'lbry-redux'; import { selectShowMatureContent } from 'redux/selectors/settings'; import HiddenNsfwClaims from './view'; const select = (state, props) => { const { uri, uris } = props; - let numberOfNsfwClaims; + let numberOfHiddenClaims; if (uri) { const { isChannel } = parseURI(uri); - numberOfNsfwClaims = isChannel - ? makeSelectNsfwCountForChannel(uri)(state) + numberOfHiddenClaims = isChannel + ? makeSelectOmittedCountForChannel(uri)(state) : makeSelectNsfwCountFromUris([uri])(state); } else if (uris) { - numberOfNsfwClaims = makeSelectNsfwCountFromUris(uris)(state); + numberOfHiddenClaims = makeSelectNsfwCountFromUris(uris)(state); } return { - numberOfNsfwClaims, + numberOfHiddenClaims, obscureNsfw: !selectShowMatureContent(state), }; }; diff --git a/ui/component/hiddenNsfwClaims/view.jsx b/ui/component/hiddenNsfwClaims/view.jsx index 4fa2d335e..412e7eb12 100644 --- a/ui/component/hiddenNsfwClaims/view.jsx +++ b/ui/component/hiddenNsfwClaims/view.jsx @@ -3,19 +3,19 @@ import React from 'react'; import Button from 'component/button'; type Props = { - numberOfNsfwClaims: number, + numberOfHiddenClaims: number, obscureNsfw: boolean, className: ?string, }; export default (props: Props) => { - const { numberOfNsfwClaims, obscureNsfw } = props; + const { numberOfHiddenClaims, obscureNsfw } = props; return ( obscureNsfw && - Boolean(numberOfNsfwClaims) && ( + Boolean(numberOfHiddenClaims) && (
- {numberOfNsfwClaims} {numberOfNsfwClaims > 1 ? __('files') : __('file')} {__('hidden due to your')}{' '} + {numberOfHiddenClaims} {numberOfHiddenClaims > 1 ? __('files') : __('file')} {__('hidden due to your')}{' '}
) -- 2.43.4 From 5feffc10a4d2b858ede60758ff6385b181c655ac Mon Sep 17 00:00:00 2001 From: jessop Date: Tue, 3 Dec 2019 18:08:17 -0500 Subject: [PATCH 3/3] bump redux --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b7f1f721..5c7d891ed 100644 --- a/package.json +++ b/package.json @@ -126,7 +126,7 @@ "imagesloaded": "^4.1.4", "json-loader": "^0.5.4", "lbry-format": "https://github.com/lbryio/lbry-format.git", - "lbry-redux": "lbryio/lbry-redux#c30889d3392b89ffffdb5beea8534f2aa0f76b19", + "lbry-redux": "lbryio/lbry-redux#9b11cfed62af7f0f8eb6fa3c88a1f8d2cce46afc", "lbryinc": "lbryio/lbryinc#2aedf5a188f028f61c45bc7ed0c747a2d4ae453a", "lint-staged": "^7.0.2", "localforage": "^1.7.1", -- 2.43.4