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 { 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),
};
};

View file

@ -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) && (
<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')} />.
</div>
)