import React from 'react'; // jshint ignore:line import Button from 'misago/components/button'; // jshint ignore:line import Form from 'misago/components/form'; import FormGroup from 'misago/components/form-group'; // jshint ignore:line import Select from 'misago/components/select'; // jshint ignore:line import YesNoSwitch from 'misago/components/yes-no-switch'; // jshint ignore:line import { patch } from 'misago/reducers/auth'; import ajax from 'misago/services/ajax'; import title from 'misago/services/page-title'; import snackbar from 'misago/services/snackbar'; import store from 'misago/services/store'; export default class extends Form { constructor(props) { super(props); this.state = { 'isLoading': false, 'is_hiding_presence': props.user.is_hiding_presence, 'limits_private_thread_invites_to': props.user.limits_private_thread_invites_to, 'subscribe_to_started_threads': props.user.subscribe_to_started_threads, 'subscribe_to_replied_threads': props.user.subscribe_to_replied_threads, 'errors': {} }; this.privateThreadInvitesChoices = [ { 'value': 0, 'icon': 'help_outline', 'label': gettext("Everybody") }, { 'value': 1, 'icon': 'done_all', 'label': gettext("Users I follow") }, { 'value': 2, 'icon': 'highlight_off', 'label': gettext("Nobody") } ]; this.subscribeToChoices = [ { 'value': 0, 'icon': 'star_border', 'label': gettext("No") }, { 'value': 1, 'icon': 'star_half', 'label': gettext("Notify") }, { 'value': 2, 'icon': 'star', 'label': gettext("Notify with e-mail") } ]; } send() { return ajax.post(this.props.user.api_url.options, { is_hiding_presence: this.state.is_hiding_presence, limits_private_thread_invites_to: this.state.limits_private_thread_invites_to, subscribe_to_started_threads: this.state.subscribe_to_started_threads, subscribe_to_replied_threads: this.state.subscribe_to_replied_threads }); } handleSuccess() { store.dispatch(patch({ is_hiding_presence: this.state.is_hiding_presence, limits_private_thread_invites_to: this.state.limits_private_thread_invites_to, subscribe_to_started_threads: this.state.subscribe_to_started_threads, subscribe_to_replied_threads: this.state.subscribe_to_replied_threads })); snackbar.success(gettext("Your forum options have been changed.")); } handleError(rejection) { if (rejection.status === 400) { snackbar.error(gettext("Please reload page and try again.")); } else { snackbar.apiError(rejection); } } componentDidMount() { title.set({ title: gettext("Forum options"), parent: gettext("Change your options") }); } render() { /* jshint ignore:start */ return

{gettext("Change forum options")}

{gettext("Privacy settings")}