From f30e439ee37aae28cd7b5f2660a2a8bb0bf97cb8 Mon Sep 17 00:00:00 2001 From: AnshVM <70061826+AnshVM@users.noreply.github.com> Date: Wed, 6 Oct 2021 05:16:58 +0530 Subject: [PATCH] message_edit: Hide recipient bar resolve topic if user lacks permission. Previously, the "resolve/unresolve topic" checkmark option was displayed in recipient bars was presented to users regardless of whether they had permission to resolve topics in that stream, which was confusing. Fixes #19880. --- static/js/message_list_view.js | 2 ++ static/templates/recipient_row.hbs | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js index e8ec987bbd..baa776456b 100644 --- a/static/js/message_list_view.js +++ b/static/js/message_list_view.js @@ -128,6 +128,8 @@ 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 a user who can edit a topic, can resolve it as well + group.user_can_resolve_topic = message_edit.is_topic_editable(message); // 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.hbs b/static/templates/recipient_row.hbs index 026454601c..8e49e3dc1d 100644 --- a/static/templates/recipient_row.hbs +++ b/static/templates/recipient_row.hbs @@ -50,10 +50,12 @@ {{/if}} {{/if}} - {{#if topic_is_resolved}} - - {{else}} - + {{#if user_can_resolve_topic}} + {{#if topic_is_resolved}} + + {{else}} + + {{/if}} {{/if}} {{#if topic_muted}}