paginates over search count rather than channel claim count #3271

Merged
jessopb merged 4 commits from fix-noMatureSearchPagination into master 2019-12-04 00:47:48 +01:00
2 changed files with 10 additions and 10 deletions
Showing only changes of commit 29ab7fe4e7 - Show all commits

View file

@ -1,23 +1,23 @@
import { connect } from 'react-redux'; 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 { selectShowMatureContent } from 'redux/selectors/settings';
import HiddenNsfwClaims from './view'; import HiddenNsfwClaims from './view';
const select = (state, props) => { const select = (state, props) => {
const { uri, uris } = props; const { uri, uris } = props;
let numberOfNsfwClaims; let numberOfHiddenClaims;
if (uri) { if (uri) {
const { isChannel } = parseURI(uri); const { isChannel } = parseURI(uri);
numberOfNsfwClaims = isChannel numberOfHiddenClaims = isChannel
? makeSelectNsfwCountForChannel(uri)(state) ? makeSelectOmittedCountForChannel(uri)(state)
: makeSelectNsfwCountFromUris([uri])(state); : makeSelectNsfwCountFromUris([uri])(state);
} else if (uris) { } else if (uris) {
numberOfNsfwClaims = makeSelectNsfwCountFromUris(uris)(state); numberOfHiddenClaims = makeSelectNsfwCountFromUris(uris)(state);
} }
return { return {
numberOfNsfwClaims, numberOfHiddenClaims,
obscureNsfw: !selectShowMatureContent(state), obscureNsfw: !selectShowMatureContent(state),
}; };
}; };

View file

@ -3,19 +3,19 @@ import React from 'react';
import Button from 'component/button'; import Button from 'component/button';
type Props = { type Props = {
numberOfNsfwClaims: number, numberOfHiddenClaims: number,
obscureNsfw: boolean, obscureNsfw: boolean,
className: ?string, className: ?string,
}; };
export default (props: Props) => { export default (props: Props) => {
const { numberOfNsfwClaims, obscureNsfw } = props; const { numberOfHiddenClaims, obscureNsfw } = props;
return ( return (
obscureNsfw && obscureNsfw &&
Boolean(numberOfNsfwClaims) && ( Boolean(numberOfHiddenClaims) && (
<div className="section--padded section__subtitle"> <div className="section--padded section__subtitle">
{numberOfNsfwClaims} {numberOfNsfwClaims > 1 ? __('files') : __('file')} {__('hidden due to your')}{' '} {numberOfHiddenClaims} {numberOfHiddenClaims > 1 ? __('files') : __('file')} {__('hidden due to your')}{' '}
<Button button="link" navigate="/$/settings" label={__('content viewing preferences')} />. <Button button="link" navigate="/$/settings" label={__('content viewing preferences')} />.
</div> </div>
) )