mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 13:51:13 +00:00
Handle enable_nsfw correctly
This commit is contained in:
parent
9869b00fe0
commit
afae55c2eb
2 changed files with 47 additions and 56 deletions
|
@ -57,7 +57,7 @@ export class Signup extends Component<
|
|||
registerRes: EMPTY_REQUEST,
|
||||
captchaRes: EMPTY_REQUEST,
|
||||
form: {
|
||||
show_nsfw: false,
|
||||
show_nsfw: !!this.isoData.site_res.site_view.site.content_warning,
|
||||
},
|
||||
captchaPlaying: false,
|
||||
siteRes: this.isoData.site_res,
|
||||
|
@ -261,27 +261,22 @@ export class Signup extends Component<
|
|||
</>
|
||||
)}
|
||||
{this.renderCaptcha()}
|
||||
{!this.state.siteRes.site_view.site.content_warning && (
|
||||
<div className="mb-3 row">
|
||||
<div className="col-sm-10">
|
||||
<div className="form-check">
|
||||
<input
|
||||
className="form-check-input"
|
||||
id="register-show-nsfw"
|
||||
type="checkbox"
|
||||
checked={this.state.form.show_nsfw}
|
||||
onChange={linkEvent(this, this.handleRegisterShowNsfwChange)}
|
||||
/>
|
||||
<label
|
||||
className="form-check-label"
|
||||
htmlFor="register-show-nsfw"
|
||||
>
|
||||
{I18NextService.i18n.t("show_nsfw")}
|
||||
</label>
|
||||
</div>
|
||||
<div className="mb-3 row">
|
||||
<div className="col-sm-10">
|
||||
<div className="form-check">
|
||||
<input
|
||||
className="form-check-input"
|
||||
id="register-show-nsfw"
|
||||
type="checkbox"
|
||||
checked={this.state.form.show_nsfw}
|
||||
onChange={linkEvent(this, this.handleRegisterShowNsfwChange)}
|
||||
/>
|
||||
<label className="form-check-label" htmlFor="register-show-nsfw">
|
||||
{I18NextService.i18n.t("show_nsfw")}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<input
|
||||
tabIndex={-1}
|
||||
autoComplete="false"
|
||||
|
|
|
@ -898,42 +898,38 @@ export class Settings extends Component<SettingsRouteProps, SettingsState> {
|
|||
/>
|
||||
</div>
|
||||
</form>
|
||||
{this.state.siteRes.site_view.local_site.enable_nsfw && (
|
||||
<>
|
||||
<div className="input-group mb-3">
|
||||
<div className="form-check">
|
||||
<input
|
||||
className="form-check-input"
|
||||
id="user-show-nsfw"
|
||||
type="checkbox"
|
||||
checked={this.state.saveUserSettingsForm.show_nsfw}
|
||||
onChange={linkEvent(this, this.handleShowNsfwChange)}
|
||||
/>
|
||||
<label className="form-check-label" htmlFor="user-show-nsfw">
|
||||
{I18NextService.i18n.t("show_nsfw")}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div className="input-group mb-3">
|
||||
<div className="form-check">
|
||||
<input
|
||||
className="form-check-input"
|
||||
id="user-blur-nsfw"
|
||||
type="checkbox"
|
||||
disabled={!this.state.saveUserSettingsForm.show_nsfw}
|
||||
checked={
|
||||
this.state.saveUserSettingsForm.blur_nsfw &&
|
||||
this.state.saveUserSettingsForm.show_nsfw
|
||||
}
|
||||
onChange={linkEvent(this, this.handleBlurNsfwChange)}
|
||||
/>
|
||||
<label className="form-check-label" htmlFor="user-blur-nsfw">
|
||||
{I18NextService.i18n.t("blur_nsfw")}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
<div className="input-group mb-3">
|
||||
<div className="form-check">
|
||||
<input
|
||||
className="form-check-input"
|
||||
id="user-show-nsfw"
|
||||
type="checkbox"
|
||||
checked={this.state.saveUserSettingsForm.show_nsfw}
|
||||
onChange={linkEvent(this, this.handleShowNsfwChange)}
|
||||
/>
|
||||
<label className="form-check-label" htmlFor="user-show-nsfw">
|
||||
{I18NextService.i18n.t("show_nsfw")}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div className="input-group mb-3">
|
||||
<div className="form-check">
|
||||
<input
|
||||
className="form-check-input"
|
||||
id="user-blur-nsfw"
|
||||
type="checkbox"
|
||||
disabled={!this.state.saveUserSettingsForm.show_nsfw}
|
||||
checked={
|
||||
this.state.saveUserSettingsForm.blur_nsfw &&
|
||||
this.state.saveUserSettingsForm.show_nsfw
|
||||
}
|
||||
onChange={linkEvent(this, this.handleBlurNsfwChange)}
|
||||
/>
|
||||
<label className="form-check-label" htmlFor="user-blur-nsfw">
|
||||
{I18NextService.i18n.t("blur_nsfw")}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div className="input-group mb-3">
|
||||
<div className="form-check">
|
||||
<input
|
||||
|
|
Loading…
Reference in a new issue