From a0592473983baf6a11bc9838a5b587e1e916b618 Mon Sep 17 00:00:00 2001 From: YJDave Date: Tue, 6 Mar 2018 00:22:18 +0530 Subject: [PATCH] message editing: Fix bugs in `recipient-row` template rendering. In `recipient-row` template, if conditions to add/hide/show edit icon for message topic is incorrect. In some cases, we only want to just hide the edit icon, but icon should be in DOM, cause in future if organization settings are changed we want to show edit icon in message row. If user can edit topic of message, surely add edit icon element to DOM regardless of user is allowed to edit or not. If user is allowed to edit then show edit icon otherwise hide edit icon element. --- static/js/message_list_view.js | 4 +--- static/templates/recipient_row.handlebars | 7 ++----- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js index b557dd10e3..701301b12f 100644 --- a/static/js/message_list_view.js +++ b/static/js/message_list_view.js @@ -79,11 +79,9 @@ function add_display_time(group, message_container, prev) { } function set_topic_edit_properties(group, message) { + group.realm_allow_message_editing = page_params.realm_allow_message_editing; group.always_visible_topic_edit = false; group.on_hover_topic_edit = false; - if (!page_params.realm_allow_message_editing) { - return; - } // Messages with no topics should always have an edit icon visible // to encourage updating them. Admins can also edit any topic. diff --git a/static/templates/recipient_row.handlebars b/static/templates/recipient_row.handlebars index 3302f0553b..866c37a385 100644 --- a/static/templates/recipient_row.handlebars +++ b/static/templates/recipient_row.handlebars @@ -33,15 +33,12 @@ {{! edit subject pencil icon }} {{#if always_visible_topic_edit}} - + {{else}} {{#if on_hover_topic_edit}} - - {{else}} - + {{/if}} {{/if}} - {{! exterior links (e.g. to a trac ticket) }} {{#each subject_links}}