hide exact url if it's marked nsfw
This commit is contained in:
parent
72be966242
commit
5decb167a2
3 changed files with 13 additions and 3 deletions
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
)
|
||||
);
|
||||
|
|
|
@ -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} />
|
||||
|
|
Loading…
Reference in a new issue