mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
editing: Hide topic-edit-pencil if message editing is disabled.
This fixes a confusing bug where administrators would be offered the convenient topic-edit pencil even if message editing was actually disabled. This doesn't yet fix the real-time sync issues of changing the setting without reloading. Fixes #5946.
This commit is contained in:
committed by
Tim Abbott
parent
669b1b8adb
commit
61fbf1a7e3
@@ -37,6 +37,7 @@ set_global('settings_emoji', {
|
||||
|
||||
set_global('settings_org', {
|
||||
reset_realm_default_language: noop,
|
||||
toggle_allow_message_editing_pencil: noop,
|
||||
toggle_email_change_display: noop,
|
||||
toggle_name_change_display: noop,
|
||||
update_message_retention_days: noop,
|
||||
|
||||
@@ -38,6 +38,7 @@ set_global('templates', {
|
||||
settings_org.reset();
|
||||
settings_org.populate_realm_domains();
|
||||
settings_org.reset_realm_default_language();
|
||||
settings_org.toggle_allow_message_editing_pencil();
|
||||
settings_org.toggle_name_change_display();
|
||||
settings_org.toggle_email_change_display();
|
||||
settings_org.update_realm_description();
|
||||
|
||||
@@ -54,6 +54,7 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {
|
||||
var realm_settings = {
|
||||
add_emoji_by_admins_only: settings_emoji.update_custom_emoji_ui,
|
||||
allow_edit_history: noop,
|
||||
allow_message_editing: noop,
|
||||
create_stream_by_admins_only: noop,
|
||||
default_language: settings_org.reset_realm_default_language,
|
||||
description: settings_org.update_realm_description,
|
||||
@@ -85,6 +86,9 @@ exports.dispatch_normal_event = function dispatch_normal_event(event) {
|
||||
} else if (event.op === 'update_dict' && event.property === 'default') {
|
||||
_.each(event.data, function (value, key) {
|
||||
page_params['realm_' + key] = value;
|
||||
if (key === 'allow_message_editing') {
|
||||
settings_org.toggle_allow_message_editing_pencil();
|
||||
}
|
||||
});
|
||||
if (event.data.authentication_methods !== undefined) {
|
||||
settings_org.populate_auth_methods(event.data.authentication_methods);
|
||||
|
||||
@@ -65,6 +65,14 @@ exports.toggle_email_change_display = function () {
|
||||
$(".change_email_tooltip").toggle();
|
||||
};
|
||||
|
||||
exports.toggle_allow_message_editing_pencil = function () {
|
||||
if (!meta.loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
$(".on_hover_topic_edit").toggle();
|
||||
};
|
||||
|
||||
exports.update_realm_description = function () {
|
||||
if (!meta.loaded) {
|
||||
return;
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
{{else}}
|
||||
{{#if on_hover_topic_edit}}
|
||||
<i class="icon-vector-pencil on_hover_topic_edit"></i>
|
||||
{{else}}
|
||||
<i class="icon-vector-pencil on_hover_topic_edit" style="display: none"></i>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user