Merge the auto-forward and antispam settings

master
kaiyou 7 years ago
parent 3ef4e1f6b7
commit fa0bda7b69

@ -87,6 +87,11 @@ class UserSettingsForm(flask_wtf.FlaskForm):
displayed_name = fields.StringField(_('Displayed name')) displayed_name = fields.StringField(_('Displayed name'))
spam_enabled = fields.BooleanField(_('Enable spam filter')) spam_enabled = fields.BooleanField(_('Enable spam filter'))
spam_threshold = fields_.IntegerSliderField(_('Spam filter tolerance')) spam_threshold = fields_.IntegerSliderField(_('Spam filter tolerance'))
forward_enabled = fields.BooleanField(_('Enable forwarding'))
forward_keep = fields.BooleanField(_('Keep a copy of the emails'))
forward_destination = fields.StringField(
_('Destination'), [validators.Optional(), validators.Email()]
)
submit = fields.SubmitField(_('Save settings')) submit = fields.SubmitField(_('Save settings'))
@ -96,15 +101,6 @@ class UserPasswordForm(flask_wtf.FlaskForm):
submit = fields.SubmitField(_('Update password')) submit = fields.SubmitField(_('Update password'))
class UserForwardForm(flask_wtf.FlaskForm):
forward_enabled = fields.BooleanField(_('Enable forwarding'))
forward_keep = fields.BooleanField(_('Keep a copy of the emails'))
forward_destination = fields.StringField(
_('Destination'), [validators.Optional(), validators.Email()]
)
submit = fields.SubmitField(_('Update'))
class UserReplyForm(flask_wtf.FlaskForm): class UserReplyForm(flask_wtf.FlaskForm):
reply_enabled = fields.BooleanField(_('Enable automatic reply')) reply_enabled = fields.BooleanField(_('Enable automatic reply'))
reply_subject = fields.StringField(_('Reply subject')) reply_subject = fields.StringField(_('Reply subject'))

@ -16,11 +16,6 @@
<i class="fa fa-lock"></i> <span>{% trans %}Update password{% endtrans %}</span> <i class="fa fa-lock"></i> <span>{% trans %}Update password{% endtrans %}</span>
</a> </a>
</li> </li>
<li>
<a href="{{ url_for('.user_forward') }}">
<i class="fa fa-share"></i> <span>{% trans %}Auto-forward{% endtrans %}</span>
</a>
</li>
<li> <li>
<a href="{{ url_for('.user_reply') }}"> <a href="{{ url_for('.user_reply') }}">
<i class="fa fa-plane"></i> <span>{% trans %}Auto-reply{% endtrans %}</span> <i class="fa fa-plane"></i> <span>{% trans %}Auto-reply{% endtrans %}</span>

@ -11,9 +11,6 @@
{% block content %} {% block content %}
<form class="form" method="post" role="form"> <form class="form" method="post" role="form">
{{ form.hidden_tag() }} {{ form.hidden_tag() }}
{% call macros.box(title=_("General settings")) %}
{{ macros.form_field(form.displayed_name) }}
{% endcall %}
{% call macros.box(title=_("Antispam")) %} {% call macros.box(title=_("Antispam")) %}
{{ macros.form_field(form.spam_enabled) }} {{ macros.form_field(form.spam_enabled) }}
@ -21,6 +18,17 @@
prepend='<span class="input-group-addon"><span id="threshold">'+form.spam_threshold.data.__str__()+'</span>&nbsp;/&nbsp;100</span>', prepend='<span class="input-group-addon"><span id="threshold">'+form.spam_threshold.data.__str__()+'</span>&nbsp;/&nbsp;100</span>',
oninput='$("#threshold").text(this.value);') }} oninput='$("#threshold").text(this.value);') }}
{% endcall %} {% endcall %}
{% call macros.box(title=_("Auto-forward")) %}
{{ macros.form_field(form.forward_enabled,
onchange="if(this.checked){$('#forward_destination,#forward_keep').removeAttr('disabled')}
else{$('#forward_destination,#forward_keep').attr('disabled', '')}") }}
{{ macros.form_field(form.forward_keep,
**{("enabled" if user.forward_enabled else "disabled"): ""}) }}
{{ macros.form_field(form.forward_destination,
**{("enabled" if user.forward_enabled else "disabled"): ""}) }}
{% endcall %}
{{ macros.form_field(form.submit) }} {{ macros.form_field(form.submit) }}
</form> </form>
{% endblock %} {% endblock %}

Loading…
Cancel
Save