mirror of https://github.com/zulip/zulip.git
settings: Added setting to turn on and off realm name in email subject.
Users having only account in one realm will not be distracted by realm name in subject lines of every email. Users who have multiple accounts in realms can turn this setting on and receive a corresponding realm name in email's subject. Tweaked by tabbott to rebase and address a few small issues. Fixes #5489.
This commit is contained in:
parent
ecbb763e79
commit
b875fe07eb
|
@ -1006,6 +1006,7 @@ function render(template_name, args) {
|
|||
enable_offline_push_notifications: true, enable_online_push_notifications: true,
|
||||
enable_digest_emails: true,
|
||||
default_desktop_notifications: true,
|
||||
realm_name_in_notifications: true,
|
||||
};
|
||||
var page_params = $.extend(page_param_checkbox_options, {
|
||||
full_name: "Alyssa P. Hacker", password_auth_enabled: true,
|
||||
|
@ -1018,7 +1019,8 @@ function render(template_name, args) {
|
|||
"enable_sounds", "enable_offline_push_notifications",
|
||||
"enable_online_push_notifications",
|
||||
"enable_digest_emails",
|
||||
"default_desktop_notifications"];
|
||||
"default_desktop_notifications",
|
||||
"realm_name_in_notifications"];
|
||||
|
||||
// Render with all booleans set to true.
|
||||
var html = render('settings_tab', {page_params: page_params});
|
||||
|
|
|
@ -678,6 +678,8 @@ exports.handle_global_notification_updates = function (notification_name, settin
|
|||
page_params.enable_digest_emails = setting;
|
||||
} else if (notification_name === "pm_content_in_desktop_notifications") {
|
||||
page_params.pm_content_in_desktop_notifications = setting;
|
||||
} else if (notification_name === "realm_name_in_notifications") {
|
||||
page_params.realm_name_in_notifications = setting;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ var notification_settings = [
|
|||
"enable_stream_push_notifications",
|
||||
"enable_stream_sounds",
|
||||
"pm_content_in_desktop_notifications",
|
||||
"realm_name_in_notifications",
|
||||
];
|
||||
|
||||
function maybe_bulk_update_stream_notification_setting(notification_checkbox,
|
||||
|
@ -36,7 +37,7 @@ exports.set_up = function () {
|
|||
notify_settings_status.hide();
|
||||
|
||||
if (!page_params.realm_show_digest_email) {
|
||||
$("#other_notifications").hide();
|
||||
$("#digest_container").hide();
|
||||
}
|
||||
|
||||
_.each(notification_settings, function (setting) {
|
||||
|
|
|
@ -153,9 +153,23 @@
|
|||
{{t "Digest emails when I'm away" }}
|
||||
</label>
|
||||
</div>
|
||||
{{!-- If you add another control group here, make sure to change
|
||||
$("#other_notifications").hide(); in settings.js to
|
||||
$("#digest_container").hide();
|
||||
|
||||
<div class="input-group" id="realm_name_in_notifications_container">
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="realm_name_in_notifications" id="realm_name_in_notifications"
|
||||
{{#if page_params.realm_name_in_notifications}}
|
||||
checked="checked"
|
||||
{{/if}} />
|
||||
<span></span>
|
||||
</label>
|
||||
<label for="realm_name_in_notifications" class="inline-block">
|
||||
{{t "Include organization name in subject of missed message emails" }}
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{{!-- If we end up removing the last control group, make sure to change
|
||||
$("#digest_container").hide(); in settings_notifications.js to
|
||||
$("#other_notifications").hide();
|
||||
--}}
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -7,7 +7,7 @@ conversations and new users, while you were away.
|
|||
{!go-to-the.md!} [Notifications](/#settings/notifications)
|
||||
{!settings.md!}
|
||||
|
||||
2. Select the **Digest emails when I'm away** option under the
|
||||
**Other notifications I want** section.
|
||||
2. Select the **Send digest emails when I'm away** option under the
|
||||
**Other notification settings** section.
|
||||
|
||||
{!save-changes.md!} notification settings.
|
||||
|
|
|
@ -297,6 +297,7 @@ def do_send_missedmessage_events_reply_in_zulip(user_profile: UserProfile,
|
|||
'message_count': message_count,
|
||||
'mention': missed_messages[0].is_stream_message(),
|
||||
'unsubscribe_link': unsubscribe_link,
|
||||
'realm_name_in_notifications': user_profile.realm_name_in_notifications,
|
||||
})
|
||||
|
||||
# If this setting (email mirroring integration) is enabled, only then
|
||||
|
|
|
@ -41,7 +41,6 @@ def build_email(template_prefix: str, to_user_id: Optional[int]=None,
|
|||
context = {}
|
||||
|
||||
context.update({
|
||||
'realm_name_in_notifications': False,
|
||||
'support_email': FromAddress.SUPPORT,
|
||||
'email_images_base_uri': settings.ROOT_DOMAIN_URI + '/static/images/emails',
|
||||
'physical_address': settings.PHYSICAL_ADDRESS,
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.6 on 2018-01-21 08:47
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('zerver', '0137_realm_upload_quota_gb'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='userprofile',
|
||||
name='realm_name_in_notifications',
|
||||
field=models.BooleanField(default=False),
|
||||
),
|
||||
]
|
|
@ -561,6 +561,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
|||
enable_online_push_notifications = models.BooleanField(default=False) # type: bool
|
||||
|
||||
enable_digest_emails = models.BooleanField(default=True) # type: bool
|
||||
realm_name_in_notifications = models.BooleanField(default=False) # type: bool
|
||||
|
||||
# Old notification field superseded by existence of stream notification
|
||||
# settings.
|
||||
|
@ -661,6 +662,7 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
|||
enable_stream_push_notifications=bool,
|
||||
enable_stream_sounds=bool,
|
||||
pm_content_in_desktop_notifications=bool,
|
||||
realm_name_in_notifications=bool,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
|
|
@ -135,6 +135,7 @@ class HomeTest(ZulipTestCase):
|
|||
"realm_message_retention_days",
|
||||
"realm_name",
|
||||
"realm_name_changes_disabled",
|
||||
"realm_name_in_notifications",
|
||||
"realm_non_active_users",
|
||||
"realm_notifications_stream_id",
|
||||
"realm_password_auth_enabled",
|
||||
|
|
|
@ -169,8 +169,9 @@ def json_change_notify_settings(
|
|||
enable_offline_push_notifications: Optional[bool]=REQ(validator=check_bool, default=None),
|
||||
enable_online_push_notifications: Optional[bool]=REQ(validator=check_bool, default=None),
|
||||
enable_digest_emails: Optional[bool]=REQ(validator=check_bool, default=None),
|
||||
pm_content_in_desktop_notifications: Optional[bool]=REQ(validator=check_bool, default=None)
|
||||
) -> HttpResponse:
|
||||
pm_content_in_desktop_notifications: Optional[bool]=REQ(validator=check_bool, default=None),
|
||||
realm_name_in_notifications: Optional[bool]=REQ(validator=check_bool, default=None)) \
|
||||
-> HttpResponse:
|
||||
result = {}
|
||||
|
||||
# Stream notification settings.
|
||||
|
|
Loading…
Reference in New Issue