mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
settings: Remove obsolete default_desktop_notifications setting.
This actually hasn't been hooked up to do anything in years. While we're at it, we remove the entire "Zulip Labs" settings page.
This commit is contained in:
@@ -52,7 +52,6 @@
|
|||||||
"settings_display": false,
|
"settings_display": false,
|
||||||
"settings_notifications": false,
|
"settings_notifications": false,
|
||||||
"settings_muting": false,
|
"settings_muting": false,
|
||||||
"settings_lab": false,
|
|
||||||
"settings_bots": false,
|
"settings_bots": false,
|
||||||
"settings_sections": false,
|
"settings_sections": false,
|
||||||
"settings_emoji": false,
|
"settings_emoji": false,
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ i18n.init({
|
|||||||
enable_offline_push_notifications: false,
|
enable_offline_push_notifications: false,
|
||||||
enable_online_push_notifications: false,
|
enable_online_push_notifications: false,
|
||||||
enable_digest_emails: false,
|
enable_digest_emails: false,
|
||||||
default_desktop_notifications: false,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ function render(template_name, args) {
|
|||||||
'alert-word-settings',
|
'alert-word-settings',
|
||||||
'attachments-settings',
|
'attachments-settings',
|
||||||
'muted-topics-settings',
|
'muted-topics-settings',
|
||||||
'ui-settings',
|
|
||||||
]);
|
]);
|
||||||
}());
|
}());
|
||||||
|
|
||||||
@@ -1073,7 +1072,6 @@ function render(template_name, args) {
|
|||||||
enable_sounds: true, enable_offline_email_notifications: true,
|
enable_sounds: true, enable_offline_email_notifications: true,
|
||||||
enable_offline_push_notifications: true, enable_online_push_notifications: true,
|
enable_offline_push_notifications: true, enable_online_push_notifications: true,
|
||||||
enable_digest_emails: true,
|
enable_digest_emails: true,
|
||||||
default_desktop_notifications: true,
|
|
||||||
realm_name_in_notifications: true,
|
realm_name_in_notifications: true,
|
||||||
};
|
};
|
||||||
var page_params = $.extend(page_param_checkbox_options, {
|
var page_params = $.extend(page_param_checkbox_options, {
|
||||||
@@ -1087,7 +1085,6 @@ function render(template_name, args) {
|
|||||||
"enable_sounds", "enable_offline_push_notifications",
|
"enable_sounds", "enable_offline_push_notifications",
|
||||||
"enable_online_push_notifications",
|
"enable_online_push_notifications",
|
||||||
"enable_digest_emails",
|
"enable_digest_emails",
|
||||||
"default_desktop_notifications",
|
|
||||||
"realm_name_in_notifications"];
|
"realm_name_in_notifications"];
|
||||||
|
|
||||||
// Render with all booleans set to true.
|
// Render with all booleans set to true.
|
||||||
|
|||||||
@@ -84,9 +84,6 @@ function setup_settings_label() {
|
|||||||
left_side_userlist: i18n.t("User list on left sidebar in narrow windows"),
|
left_side_userlist: i18n.t("User list on left sidebar in narrow windows"),
|
||||||
twenty_four_hour_time: i18n.t("24-hour time (17:00 instead of 5:00 PM)"),
|
twenty_four_hour_time: i18n.t("24-hour time (17:00 instead of 5:00 PM)"),
|
||||||
translate_emoticons: i18n.t("Translate emoticons (convert <code>:)</code> to 😃 in messages)"),
|
translate_emoticons: i18n.t("Translate emoticons (convert <code>:)</code> to 😃 in messages)"),
|
||||||
|
|
||||||
// Zulip Labs
|
|
||||||
default_desktop_notifications: i18n.t("Enable desktop notifications for new streams"),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -104,7 +101,6 @@ function _setup_page() {
|
|||||||
"alert-words": i18n.t("Alert words"),
|
"alert-words": i18n.t("Alert words"),
|
||||||
"uploaded-files": i18n.t("Uploaded files"),
|
"uploaded-files": i18n.t("Uploaded files"),
|
||||||
"muted-topics": i18n.t("Muted topics"),
|
"muted-topics": i18n.t("Muted topics"),
|
||||||
"zulip-labs": i18n.t("Zulip labs"),
|
|
||||||
"organization-profile": i18n.t("Organization profile"),
|
"organization-profile": i18n.t("Organization profile"),
|
||||||
"organization-settings": i18n.t("Organization settings"),
|
"organization-settings": i18n.t("Organization settings"),
|
||||||
"organization-permissions": i18n.t("Organization permissions"),
|
"organization-permissions": i18n.t("Organization permissions"),
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
var settings_lab = (function () {
|
|
||||||
|
|
||||||
var exports = {};
|
|
||||||
|
|
||||||
exports.set_up = function () {
|
|
||||||
$("#ui-settings-status").hide();
|
|
||||||
|
|
||||||
$("#ui-settings .ui-settings-form").change(function (e) {
|
|
||||||
e.preventDefault();
|
|
||||||
var labs_updates = {};
|
|
||||||
_.each(["default_desktop_notifications"],
|
|
||||||
function (setting) {
|
|
||||||
labs_updates[setting] = $("#" + setting).is(":checked");
|
|
||||||
});
|
|
||||||
|
|
||||||
channel.patch({
|
|
||||||
url: '/json/settings/ui',
|
|
||||||
data: labs_updates,
|
|
||||||
success: function () {
|
|
||||||
var message = i18n.t("Updated settings! You will need to reload for these changes to take effect.", page_params);
|
|
||||||
var ui_settings_status = $('#ui-settings-status').expectOne();
|
|
||||||
|
|
||||||
ui_report.success(message, ui_settings_status);
|
|
||||||
},
|
|
||||||
error: function (xhr) {
|
|
||||||
ui_report.error(i18n.t("Error changing settings"), xhr, $('#ui-settings-status').expectOne());
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return exports;
|
|
||||||
}());
|
|
||||||
|
|
||||||
if (typeof module !== 'undefined') {
|
|
||||||
module.exports = settings_lab;
|
|
||||||
}
|
|
||||||
@@ -14,7 +14,6 @@ exports.initialize = function () {
|
|||||||
load_func_dict.set('alert-words', alert_words_ui.set_up_alert_words);
|
load_func_dict.set('alert-words', alert_words_ui.set_up_alert_words);
|
||||||
load_func_dict.set('uploaded-files', attachments_ui.set_up_attachments);
|
load_func_dict.set('uploaded-files', attachments_ui.set_up_attachments);
|
||||||
load_func_dict.set('muted-topics', settings_muting.set_up);
|
load_func_dict.set('muted-topics', settings_muting.set_up);
|
||||||
load_func_dict.set('zulip-labs', settings_lab.set_up);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.load_settings_section = function (section) {
|
exports.load_settings_section = function (section) {
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
<div id="ui-settings" class="settings-section" data-name="zulip-labs">
|
|
||||||
<div class="alert" id="ui-settings-status"></div>
|
|
||||||
<form class="ui-settings-form">
|
|
||||||
<div class="tip">{{t "Features for the brave. Labs features may change, break, or disappear at any time." }}</div>
|
|
||||||
<div id="lab-ui-settings">
|
|
||||||
<h3>{{t "UI Settings"}}</h3>
|
|
||||||
|
|
||||||
{{partial "settings_checkbox"
|
|
||||||
"setting_name" "default_desktop_notifications"
|
|
||||||
"is_checked" page_params.default_desktop_notifications
|
|
||||||
"label" settings_label.default_desktop_notifications}}
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
</div>
|
|
||||||
@@ -12,6 +12,4 @@
|
|||||||
{{ partial "attachments-settings" }}
|
{{ partial "attachments-settings" }}
|
||||||
|
|
||||||
{{ partial "muted-topics-settings" }}
|
{{ partial "muted-topics-settings" }}
|
||||||
|
|
||||||
{{ partial "ui-settings" }}
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -39,10 +39,6 @@
|
|||||||
<div class="icon icon-vector-eye-close"></div>
|
<div class="icon icon-vector-eye-close"></div>
|
||||||
<div class="text">{{ _('Muted topics') }}</div>
|
<div class="text">{{ _('Muted topics') }}</div>
|
||||||
</li>
|
</li>
|
||||||
<li tabindex="0" data-section="zulip-labs">
|
|
||||||
<i class="icon icon-vector-beaker"></i>
|
|
||||||
<div class="text">{{ _('Zulip labs') }}</div>
|
|
||||||
</li>
|
|
||||||
|
|
||||||
<li class="admin" tabindex="0" data-section="organization-profile">
|
<li class="admin" tabindex="0" data-section="organization-profile">
|
||||||
<i class="icon icon-vector-lock"></i>
|
<i class="icon icon-vector-lock"></i>
|
||||||
|
|||||||
@@ -93,8 +93,6 @@ def find_edges_to_remove(graph, methods):
|
|||||||
('compose', 'echo'),
|
('compose', 'echo'),
|
||||||
('compose', 'resize'),
|
('compose', 'resize'),
|
||||||
('settings', 'resize'),
|
('settings', 'resize'),
|
||||||
('settings', 'settings_lab'),
|
|
||||||
('settings_lab', 'resize'),
|
|
||||||
('compose', 'unread_ops'),
|
('compose', 'unread_ops'),
|
||||||
('compose', 'drafts'),
|
('compose', 'drafts'),
|
||||||
('echo', 'message_edit'),
|
('echo', 'message_edit'),
|
||||||
|
|||||||
@@ -3059,11 +3059,6 @@ def do_change_enter_sends(user_profile: UserProfile, enter_sends: bool) -> None:
|
|||||||
user_profile.enter_sends = enter_sends
|
user_profile.enter_sends = enter_sends
|
||||||
user_profile.save(update_fields=["enter_sends"])
|
user_profile.save(update_fields=["enter_sends"])
|
||||||
|
|
||||||
def do_change_default_desktop_notifications(user_profile: UserProfile,
|
|
||||||
default_desktop_notifications: bool) -> None:
|
|
||||||
user_profile.default_desktop_notifications = default_desktop_notifications
|
|
||||||
user_profile.save(update_fields=["default_desktop_notifications"])
|
|
||||||
|
|
||||||
def do_set_user_display_setting(user_profile: UserProfile,
|
def do_set_user_display_setting(user_profile: UserProfile,
|
||||||
setting_name: str,
|
setting_name: str,
|
||||||
setting_value: Union[bool, Text]) -> None:
|
setting_value: Union[bool, Text]) -> None:
|
||||||
|
|||||||
@@ -273,7 +273,6 @@ def fetch_initial_state_data(user_profile: UserProfile,
|
|||||||
if want('update_global_notifications'):
|
if want('update_global_notifications'):
|
||||||
for notification in UserProfile.notification_setting_types:
|
for notification in UserProfile.notification_setting_types:
|
||||||
state[notification] = getattr(user_profile, notification)
|
state[notification] = getattr(user_profile, notification)
|
||||||
state['default_desktop_notifications'] = user_profile.default_desktop_notifications
|
|
||||||
|
|
||||||
if want('zulip_version'):
|
if want('zulip_version'):
|
||||||
state['zulip_version'] = ZULIP_VERSION
|
state['zulip_version'] = ZULIP_VERSION
|
||||||
|
|||||||
@@ -217,7 +217,6 @@ def users_to_zerver_userprofile(slack_data_dir: str, users: List[ZerverFieldsT],
|
|||||||
avatar_source='U',
|
avatar_source='U',
|
||||||
is_bot=user.get('is_bot', False),
|
is_bot=user.get('is_bot', False),
|
||||||
avatar_version=1,
|
avatar_version=1,
|
||||||
default_desktop_notifications=True,
|
|
||||||
timezone=timezone,
|
timezone=timezone,
|
||||||
default_sending_stream=None,
|
default_sending_stream=None,
|
||||||
enable_offline_email_notifications=True,
|
enable_offline_email_notifications=True,
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.11 on 2018-04-28 20:34
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('zerver', '0162_change_default_community_topic_editing'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='userprofile',
|
||||||
|
name='default_desktop_notifications',
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -642,10 +642,6 @@ class UserProfile(AbstractBaseUser, PermissionsMixin):
|
|||||||
enable_digest_emails = models.BooleanField(default=True) # type: bool
|
enable_digest_emails = models.BooleanField(default=True) # type: bool
|
||||||
realm_name_in_notifications = models.BooleanField(default=False) # type: bool
|
realm_name_in_notifications = models.BooleanField(default=False) # type: bool
|
||||||
|
|
||||||
# Old notification field superseded by existence of stream notification
|
|
||||||
# settings.
|
|
||||||
default_desktop_notifications = models.BooleanField(default=True) # type: bool
|
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
last_reminder = models.DateTimeField(default=None, null=True) # type: Optional[datetime.datetime]
|
last_reminder = models.DateTimeField(default=None, null=True) # type: Optional[datetime.datetime]
|
||||||
|
|||||||
@@ -1150,7 +1150,6 @@ class TestHumanUsersOnlyDecorator(ZulipTestCase):
|
|||||||
"/api/v1/settings",
|
"/api/v1/settings",
|
||||||
"/api/v1/settings/display",
|
"/api/v1/settings/display",
|
||||||
"/api/v1/settings/notifications",
|
"/api/v1/settings/notifications",
|
||||||
"/api/v1/settings/ui",
|
|
||||||
"/api/v1/users/me/profile_data"
|
"/api/v1/users/me/profile_data"
|
||||||
]
|
]
|
||||||
for endpoint in patch_endpoints:
|
for endpoint in patch_endpoints:
|
||||||
|
|||||||
@@ -54,7 +54,6 @@ class HomeTest(ZulipTestCase):
|
|||||||
"custom_profile_field_types",
|
"custom_profile_field_types",
|
||||||
"custom_profile_fields",
|
"custom_profile_fields",
|
||||||
"debug_mode",
|
"debug_mode",
|
||||||
"default_desktop_notifications",
|
|
||||||
"default_language",
|
"default_language",
|
||||||
"default_language_name",
|
"default_language_name",
|
||||||
"development_environment",
|
"development_environment",
|
||||||
|
|||||||
@@ -119,9 +119,6 @@ class ChangeSettingsTest(ZulipTestCase):
|
|||||||
self.check_for_toggle_param_patch("/json/settings/notifications",
|
self.check_for_toggle_param_patch("/json/settings/notifications",
|
||||||
notification_setting)
|
notification_setting)
|
||||||
|
|
||||||
def test_ui_settings(self) -> None:
|
|
||||||
self.check_for_toggle_param_patch("/json/settings/ui", "default_desktop_notifications")
|
|
||||||
|
|
||||||
def test_toggling_boolean_user_display_settings(self) -> None:
|
def test_toggling_boolean_user_display_settings(self) -> None:
|
||||||
"""Test updating each boolean setting in UserProfile property_types"""
|
"""Test updating each boolean setting in UserProfile property_types"""
|
||||||
boolean_settings = (s for s in UserProfile.property_types if UserProfile.property_types[s] is bool)
|
boolean_settings = (s for s in UserProfile.property_types if UserProfile.property_types[s] is bool)
|
||||||
|
|||||||
@@ -10,8 +10,7 @@ from django.urls import reverse
|
|||||||
from zerver.decorator import has_request_variables, \
|
from zerver.decorator import has_request_variables, \
|
||||||
zulip_login_required, REQ, human_users_only
|
zulip_login_required, REQ, human_users_only
|
||||||
from zerver.lib.actions import do_change_password, do_change_notification_settings, \
|
from zerver.lib.actions import do_change_password, do_change_notification_settings, \
|
||||||
do_change_enter_sends, do_change_default_desktop_notifications, \
|
do_change_enter_sends, do_regenerate_api_key, do_change_avatar_fields, \
|
||||||
do_regenerate_api_key, do_change_avatar_fields, \
|
|
||||||
do_set_user_display_setting, validate_email, do_change_user_email, \
|
do_set_user_display_setting, validate_email, do_change_user_email, \
|
||||||
do_start_email_change_process, check_change_full_name
|
do_start_email_change_process, check_change_full_name
|
||||||
from zerver.lib.avatar import avatar_url
|
from zerver.lib.avatar import avatar_url
|
||||||
@@ -52,21 +51,6 @@ def confirm_email_change(request: HttpRequest, confirmation_key: str) -> HttpRes
|
|||||||
}
|
}
|
||||||
return render(request, 'confirmation/confirm_email_change.html', context=ctx)
|
return render(request, 'confirmation/confirm_email_change.html', context=ctx)
|
||||||
|
|
||||||
@human_users_only
|
|
||||||
@has_request_variables
|
|
||||||
def json_change_ui_settings(
|
|
||||||
request: HttpRequest, user_profile: UserProfile,
|
|
||||||
default_desktop_notifications: Optional[bool]=REQ(validator=check_bool, default=None)
|
|
||||||
) -> HttpResponse:
|
|
||||||
result = {}
|
|
||||||
|
|
||||||
if default_desktop_notifications is not None and \
|
|
||||||
user_profile.default_desktop_notifications != default_desktop_notifications:
|
|
||||||
do_change_default_desktop_notifications(user_profile, default_desktop_notifications)
|
|
||||||
result['default_desktop_notifications'] = default_desktop_notifications
|
|
||||||
|
|
||||||
return json_success(result)
|
|
||||||
|
|
||||||
@human_users_only
|
@human_users_only
|
||||||
@has_request_variables
|
@has_request_variables
|
||||||
def json_change_settings(request: HttpRequest, user_profile: UserProfile,
|
def json_change_settings(request: HttpRequest, user_profile: UserProfile,
|
||||||
|
|||||||
@@ -1155,7 +1155,6 @@ JS_SPECS = {
|
|||||||
'js/settings_notifications.js',
|
'js/settings_notifications.js',
|
||||||
'js/settings_bots.js',
|
'js/settings_bots.js',
|
||||||
'js/settings_muting.js',
|
'js/settings_muting.js',
|
||||||
'js/settings_lab.js',
|
|
||||||
'js/settings_sections.js',
|
'js/settings_sections.js',
|
||||||
'js/settings_emoji.js',
|
'js/settings_emoji.js',
|
||||||
'js/settings_org.js',
|
'js/settings_org.js',
|
||||||
|
|||||||
@@ -274,8 +274,6 @@ v1_api_and_json_patterns = [
|
|||||||
{'PATCH': 'zerver.views.user_settings.update_display_settings_backend'}),
|
{'PATCH': 'zerver.views.user_settings.update_display_settings_backend'}),
|
||||||
url(r'^settings/notifications$', rest_dispatch,
|
url(r'^settings/notifications$', rest_dispatch,
|
||||||
{'PATCH': 'zerver.views.user_settings.json_change_notify_settings'}),
|
{'PATCH': 'zerver.views.user_settings.json_change_notify_settings'}),
|
||||||
url(r'^settings/ui$', rest_dispatch,
|
|
||||||
{'PATCH': 'zerver.views.user_settings.json_change_ui_settings'}),
|
|
||||||
|
|
||||||
# users/me/alert_words -> zerver.views.alert_words
|
# users/me/alert_words -> zerver.views.alert_words
|
||||||
url(r'^users/me/alert_words$', rest_dispatch,
|
url(r'^users/me/alert_words$', rest_dispatch,
|
||||||
|
|||||||
Reference in New Issue
Block a user