Actually hide NSFW content #1748

Merged
neb-b merged 8 commits from hide-nsfw into master 2018-07-13 20:31:15 +02:00
3 changed files with 13 additions and 3 deletions
Showing only changes of commit 5decb167a2 - Show all commits

View file

@ -27,6 +27,7 @@ type Props = {
clearPublish: () => void,
updatePublishForm: ({}) => void,
hideNoResult: boolean, // don't show the tile if there is no claim at this uri
displayHiddenMessage?: boolean,
};
class FileTile extends React.PureComponent<Props> {
@ -62,11 +63,18 @@ class FileTile extends React.PureComponent<Props> {
clearPublish,
updatePublishForm,
hideNoResult,
displayHiddenMessage,
} = this.props;
const shouldHide = !claimIsMine && obscureNsfw && metadata && metadata.nsfw;
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);

View file

@ -1,5 +1,6 @@
// @flow
import React from 'react';
import Button from 'component/button';
type Props = {
numberOfNsfwClaims: number,
@ -14,7 +15,8 @@ export default (props: Props) => {
Boolean(numberOfNsfwClaims) && (
<div className={className || 'help'}>
{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>
)
);

View file

@ -73,7 +73,7 @@ class SearchPage extends React.PureComponent<Props> {
<Icon icon={icons.HELP} />
</ToolTip>
</div>
<FileTile fullWidth uri={normalizeURI(query)} showUri />
<FileTile fullWidth showUri displayHiddenMessage uri={normalizeURI(query)} />
</React.Fragment>
)}
<FileListSearch query={query} />