add setting to show/hide NSFW content
This commit is contained in:
parent
399fb5c7c8
commit
17bfbb8940
2 changed files with 13 additions and 4 deletions
|
@ -36,7 +36,7 @@ var SearchResults = React.createClass({
|
|||
render: function() {
|
||||
var rows = [];
|
||||
this.props.results.forEach(function(result) {
|
||||
if (!result.value.nsfw) {
|
||||
if (!result.value.nsfw || lbry.setSettings(settings)['show_nsfw']) {
|
||||
rows.push(
|
||||
<SearchResultRow key={result.name} name={result.name} title={result.value.title} imgUrl={result.value.thumbnail}
|
||||
description={result.value.description} cost={result.cost} />
|
||||
|
@ -152,7 +152,7 @@ var FeaturedContentItem = React.createClass({
|
|||
},
|
||||
|
||||
render: function() {
|
||||
if (this.state.metadata == null || this.state.metadata.nsfw) {
|
||||
if (this.state.metadata == null || (this.state.metadata.nsfw && !(lbry.setSettings(settings)['show_nsfw']))) {
|
||||
// Still waiting for metadata, or item is NSFW
|
||||
return null;
|
||||
}
|
||||
|
@ -251,4 +251,4 @@ var DiscoverPage = React.createClass({
|
|||
</main>
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -22,6 +22,9 @@ var SettingsPage = React.createClass({
|
|||
});
|
||||
lbry.setSettings(settings);
|
||||
},
|
||||
onRunOnNsfwChange: function (event) {
|
||||
this.storeSetting('show_nsfw', event.target.checked);
|
||||
},
|
||||
onRunOnStartChange: function (event) {
|
||||
this.storeSetting('run_on_startup', event.target.checked);
|
||||
},
|
||||
|
@ -77,6 +80,12 @@ var SettingsPage = React.createClass({
|
|||
|
||||
return (
|
||||
<main>
|
||||
<section className="card">
|
||||
<h3>Content Filtering</h3>
|
||||
<label style={settingsCheckBoxOptionStyles}>
|
||||
<input type="checkbox" onChange={this.onRunOnNsfwChange} defaultChecked={this.state.settings.show_nsfw} /> Show NSFW content
|
||||
</label>
|
||||
</section>
|
||||
<section className="card">
|
||||
<h3>Run on Startup</h3>
|
||||
<label style={settingsCheckBoxOptionStyles}>
|
||||
|
@ -120,4 +129,4 @@ var SettingsPage = React.createClass({
|
|||
</main>
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue