mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 16:37:23 +00:00
org settings: Make sync_realm_settings to be available at load time.
This moves `sync_realm_settings` function out of `_setup` so that we can call `settings_org.sync_realm_settings` without opening settings page at least once. This also fixes a minor bug in which if we have two tabs opened and in one we haven't opened settings page at least once and in another we change an org setting, then we get an exception in the former tab because of the event as `sync_realm_settings` isn't defined yet.
This commit is contained in:
committed by
Tim Abbott
parent
29f57d54a0
commit
7eea186306
@@ -351,6 +351,25 @@ function discard_property_element_changes(elem) {
|
|||||||
exports.handle_dependent_subsettings(property_name);
|
exports.handle_dependent_subsettings(property_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.sync_realm_settings = function (property) {
|
||||||
|
if (!overlays.settings_open()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'message_content_edit_limit_seconds') {
|
||||||
|
property = 'message_content_edit_limit_minutes';
|
||||||
|
} else if (property === 'create_stream_by_admins_only' || property === 'waiting_period_threshold') {
|
||||||
|
// We use this path for `waiting_period_threshold` property because we
|
||||||
|
// don't get both 'create_stream_by_admins_only' and 'waiting_period_threshold'
|
||||||
|
// in the same event to determine the value of dropdown.
|
||||||
|
property = 'create_stream_permission';
|
||||||
|
}
|
||||||
|
var element = $('#id_realm_'+property);
|
||||||
|
if (element.length) {
|
||||||
|
discard_property_element_changes(element);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
function _set_up() {
|
function _set_up() {
|
||||||
meta.loaded = true;
|
meta.loaded = true;
|
||||||
|
|
||||||
@@ -600,25 +619,6 @@ function _set_up() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
exports.sync_realm_settings = function (property) {
|
|
||||||
if (!overlays.settings_open()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'message_content_edit_limit_seconds') {
|
|
||||||
property = 'message_content_edit_limit_minutes';
|
|
||||||
} else if (property === 'create_stream_by_admins_only' || property === 'waiting_period_threshold') {
|
|
||||||
// We use this path for `waiting_period_threshold` property because we
|
|
||||||
// don't get both 'create_stream_by_admins_only' and 'waiting_period_threshold'
|
|
||||||
// in the same event to determine the value of dropdown.
|
|
||||||
property = 'create_stream_permission';
|
|
||||||
}
|
|
||||||
var element = $('#id_realm_'+property);
|
|
||||||
if (element.length) {
|
|
||||||
discard_property_element_changes(element);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
$(".organization form.org-authentications-form").off('submit').on('submit', function (e) {
|
$(".organization form.org-authentications-form").off('submit').on('submit', function (e) {
|
||||||
var authentication_methods_status = $("#admin-realm-authentication-methods-status").expectOne();
|
var authentication_methods_status = $("#admin-realm-authentication-methods-status").expectOne();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user