Add a digest emails checkbox to your settings page.

(imported from commit cf1dbae6ca30d2489a77e822c34941a986b93bbd)
This commit is contained in:
Jessica McKellar 2013-12-01 20:00:23 -05:00
parent 207cfc449d
commit c1058355f6
3 changed files with 24 additions and 1 deletions

View File

@ -1060,6 +1060,10 @@ $(function () {
page_params.enable_offline_push_notifications = result.enable_offline_push_notifications;
}
if (result.enable_digest_emails !== undefined) {
page_params.enable_digest_emails = result.enable_digest_emails;
}
notify_settings_status.removeClass(status_classes)
.addClass('alert-success')
.text(message).stop(true).fadeTo(0,1);

View File

@ -150,6 +150,18 @@
</label>
</div>
<div class="control-group">
<div class="controls">
<input type="checkbox" name="enable_digest_emails" id="enable_digest_emails"
{% if user_profile.enable_digest_emails %}
checked="yes"
{% endif %} />
</div>
<label for="enable_digest_emails" class="control-label">
Digest emails when I'm away
</label>
</div>
<p class="notification-settings-note">Change notification settings for individual streams on your <a href="/#subscriptions">Streams page</a>.</p>
<div class="control-group">

View File

@ -768,6 +768,7 @@ def home(request):
user_profile.enable_offline_email_notifications,
enable_offline_push_notifications =
user_profile.enable_offline_push_notifications,
enable_digest_emails = user_profile.enable_digest_emails,
event_queue_id = register_ret['queue_id'],
last_event_id = register_ret['last_event_id'],
max_message_id = register_ret['max_message_id'],
@ -1843,7 +1844,9 @@ def json_change_notify_settings(request, user_profile,
enable_offline_email_notifications=REQ(converter=lambda x: x == "on",
default=False),
enable_offline_push_notifications=REQ(converter=lambda x: x == "on",
default=False)):
default=False),
enable_digest_emails=REQ(converter=lambda x: x == "on",
default=False)):
result = {}
@ -1863,6 +1866,10 @@ def json_change_notify_settings(request, user_profile,
do_change_enable_offline_push_notifications(user_profile, enable_offline_push_notifications)
result['enable_offline_push_notifications'] = enable_offline_push_notifications
if user_profile.enable_digest_emails != enable_digest_emails:
do_change_enable_digest_emails(user_profile, enable_digest_emails)
result['enable_digest_emails'] = enable_digest_emails
return json_success(result)
@authenticated_json_post_view