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,20 +981,25 @@ export class Settings extends Component<SettingsRouteProps, SettingsState> {
</label> </label>
</div> </div>
</div> </div>
<div className="input-group mb-3"> {enableDownvotes(siteRes) && (
<div className="form-check"> <div className="input-group mb-3">
<input <div className="form-check">
className="form-check-input" <input
id="user-show-downvotes" className="form-check-input"
type="checkbox" id="user-show-downvotes"
checked={this.state.saveUserSettingsForm.show_downvotes} type="checkbox"
onChange={linkEvent(this, this.handleShowDownvotesChange)} checked={this.state.saveUserSettingsForm.show_downvotes}
/> onChange={linkEvent(this, this.handleShowDownvotesChange)}
<label className="form-check-label" htmlFor="user-show-downvotes"> />
{I18NextService.i18n.t("show_downvotes")} <label
</label> className="form-check-label"
htmlFor="user-show-downvotes"
>
{I18NextService.i18n.t("show_downvotes")}
</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