1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-07-15 07:52:14 +00:00

[user setting] added 'Email Notification of File Changes'

This commit is contained in:
llj 2018-12-10 16:11:10 +08:00
parent e9778fccd4
commit 2425d9ac0b

View File

@ -23,6 +23,8 @@
<li class="tab"><a href="#lang-setting">{% trans "Language" %}</a></li>
<li class="tab"><a href="#email-notice">{% trans "Email Notification" %}</a></li>
{% if two_factor_auth_enabled %}
<li class="tab"><a href="#two-factor-auth">{% trans "Two-Factor Authentication" %}</a></li>
{% endif %}
@ -124,6 +126,19 @@
</div>
</div>
<div class="setting-item" id="email-notice">
<h3>{% trans "Email Notification of File Changes" %}</h3>
<form method="post" action="" id="set-email-notice-interval-form">{% csrf_token %}
{# email_notification_interval: in seconds #}
<input type="radio" name="interval" value="0" class="vam" id="interval-option1" {% if email_notification_interval == 0 %}checked="checked"{% endif %} /> <label class="vam" for="interval-option1">{% trans "Don't send emails" %}</label> <br />
<input type="radio" name="interval" value="3600" class="vam" id="interval-option2" {% if email_notification_interval == 3600 %}checked="checked"{% endif %} /> <label class="vam" for="interval-option2">{% trans "Per hour" %}</label> <br />
<input type="radio" name="interval" value="14400" class="vam" id="interval-option3" {% if email_notification_interval == 14400 %}checked="checked"{% endif %} /> <label class="vam" for="interval-option3">{% trans "Per 4 hours" %}</label> <br />
<input type="radio" name="interval" value="86400" class="vam" id="interval-option4" {% if email_notification_interval == 86400 %}checked="checked"{% endif %} /> <label class="vam" for="interval-option4">{% trans "Per day" %}</label> <br />
<input type="radio" name="interval" value="604800" class="vam" id="interval-option5" {% if email_notification_interval == 604800 %}checked="checked"{% endif %} /> <label class="vam" for="interval-option5">{% trans "Per week" %}</label> <br />
<button type="submit" class="submit">{% trans "Submit" %}</button>
</form>
</div>
{% if two_factor_auth_enabled %}
<div class="setting-item" id="two-factor-auth">
<h3>{% trans "Two-Factor Authentication" %}</h3>
@ -334,5 +349,21 @@ $('#update-webdav-passwd .generate-random-password').click(function() {
}
});
})();
$('#set-email-notice-interval-form').on('submit', function() {
var interval = $('[name="interval"]:checked', $(this)).val();
$.ajax({
url: '{{SITE_ROOT}}api2/account/info/',
type: 'PUT',
data: {'email_notification_interval': interval},
dataType: 'json',
beforeSend: prepareCSRFToken,
success: function() {
feedback("{% trans "Success" %}", 'success');
},
error: ajaxErrorHandler
});
return false;
});
</script>
{% endblock %}