Only show downvotes setting if site has downvotes enabled.

This commit is contained in:
Dessalines 2024-04-17 11:09:38 -04:00
parent 03f060ade2
commit f35c8a3add

View file

@ -1,5 +1,6 @@
import { import {
communityToChoice, communityToChoice,
enableDownvotes,
fetchCommunities, fetchCommunities,
fetchThemeList, fetchThemeList,
fetchUsers, fetchUsers,
@ -714,6 +715,7 @@ export class Settings extends Component<SettingsRouteProps, SettingsState> {
saveUserSettingsHtmlForm() { saveUserSettingsHtmlForm() {
const selectedLangs = this.state.saveUserSettingsForm.discussion_languages; const selectedLangs = this.state.saveUserSettingsForm.discussion_languages;
const siteRes = this.state.siteRes;
return ( return (
<> <>
@ -746,8 +748,8 @@ export class Settings extends Component<SettingsRouteProps, SettingsState> {
onContentChange={this.handleBioChange} onContentChange={this.handleBioChange}
maxLength={300} maxLength={300}
hideNavigationWarnings hideNavigationWarnings
allLanguages={this.state.siteRes.all_languages} allLanguages={siteRes.all_languages}
siteLanguages={this.state.siteRes.discussion_languages} siteLanguages={siteRes.discussion_languages}
/> />
</div> </div>
</div> </div>
@ -843,8 +845,8 @@ export class Settings extends Component<SettingsRouteProps, SettingsState> {
</div> </div>
</div> </div>
<LanguageSelect <LanguageSelect
allLanguages={this.state.siteRes.all_languages} allLanguages={siteRes.all_languages}
siteLanguages={this.state.siteRes.discussion_languages} siteLanguages={siteRes.discussion_languages}
selectedLanguageIds={selectedLangs} selectedLanguageIds={selectedLangs}
multiple={true} multiple={true}
showLanguageWarning={true} showLanguageWarning={true}
@ -979,6 +981,7 @@ export class Settings extends Component<SettingsRouteProps, SettingsState> {
</label> </label>
</div> </div>
</div> </div>
{enableDownvotes(siteRes) && (
<div className="input-group mb-3"> <div className="input-group mb-3">
<div className="form-check"> <div className="form-check">
<input <input
@ -988,11 +991,15 @@ export class Settings extends Component<SettingsRouteProps, SettingsState> {
checked={this.state.saveUserSettingsForm.show_downvotes} checked={this.state.saveUserSettingsForm.show_downvotes}
onChange={linkEvent(this, this.handleShowDownvotesChange)} onChange={linkEvent(this, this.handleShowDownvotesChange)}
/> />
<label className="form-check-label" htmlFor="user-show-downvotes"> <label
className="form-check-label"
htmlFor="user-show-downvotes"
>
{I18NextService.i18n.t("show_downvotes")} {I18NextService.i18n.t("show_downvotes")}
</label> </label>
</div> </div>
</div> </div>
)}
<div className="input-group mb-3"> <div className="input-group mb-3">
<div className="form-check"> <div className="form-check">
<input <input