Actually hide NSFW content #1748
3 changed files with 13 additions and 3 deletions
|
@ -27,6 +27,7 @@ type Props = {
|
||||||
clearPublish: () => void,
|
clearPublish: () => void,
|
||||||
updatePublishForm: ({}) => void,
|
updatePublishForm: ({}) => void,
|
||||||
hideNoResult: boolean, // don't show the tile if there is no claim at this uri
|
hideNoResult: boolean, // don't show the tile if there is no claim at this uri
|
||||||
|
displayHiddenMessage?: boolean,
|
||||||
};
|
};
|
||||||
|
|
||||||
class FileTile extends React.PureComponent<Props> {
|
class FileTile extends React.PureComponent<Props> {
|
||||||
|
@ -62,11 +63,18 @@ class FileTile extends React.PureComponent<Props> {
|
||||||
clearPublish,
|
clearPublish,
|
||||||
updatePublishForm,
|
updatePublishForm,
|
||||||
hideNoResult,
|
hideNoResult,
|
||||||
|
displayHiddenMessage,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const shouldHide = !claimIsMine && obscureNsfw && metadata && metadata.nsfw;
|
const shouldHide = !claimIsMine && obscureNsfw && metadata && metadata.nsfw;
|
||||||
if (shouldHide) {
|
if (shouldHide) {
|
||||||
return null;
|
return displayHiddenMessage ? (
|
||||||
|
<span className="help">
|
||||||
|
{__('This file is hidden because it is marked NSFW. Update your')}{' '}
|
||||||
|
<Button button="link" navigate="/settings" label={__('content viewing preferences')} />{' '}
|
||||||
|
{__('to see it')}.
|
||||||
|
</span>
|
||||||
|
) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uri = normalizeURI(this.props.uri);
|
const uri = normalizeURI(this.props.uri);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// @flow
|
// @flow
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import Button from 'component/button';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
numberOfNsfwClaims: number,
|
numberOfNsfwClaims: number,
|
||||||
|
@ -14,7 +15,8 @@ export default (props: Props) => {
|
||||||
Boolean(numberOfNsfwClaims) && (
|
Boolean(numberOfNsfwClaims) && (
|
||||||
<div className={className || 'help'}>
|
<div className={className || 'help'}>
|
||||||
{numberOfNsfwClaims} {numberOfNsfwClaims > 1 ? __('files') : __('file')}{' '}
|
{numberOfNsfwClaims} {numberOfNsfwClaims > 1 ? __('files') : __('file')}{' '}
|
||||||
{__('hidden due to your content viewing preferences.')}
|
{__('hidden due to your')}{' '}
|
||||||
|
<Button button="link" navigate="/settings" label={__('content viewing preferences')} />.
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -73,7 +73,7 @@ class SearchPage extends React.PureComponent<Props> {
|
||||||
<Icon icon={icons.HELP} />
|
<Icon icon={icons.HELP} />
|
||||||
</ToolTip>
|
</ToolTip>
|
||||||
</div>
|
</div>
|
||||||
<FileTile fullWidth uri={normalizeURI(query)} showUri />
|
<FileTile fullWidth showUri displayHiddenMessage uri={normalizeURI(query)} />
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)}
|
)}
|
||||||
<FileListSearch query={query} />
|
<FileListSearch query={query} />
|
||||||
|
|
Loading…
Reference in a new issue