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.
This commit is contained in:
AnshVM 2021-10-06 05:16:58 +05:30 committed by GitHub
parent 3b29c61409
commit f30e439ee3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -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.

View File

@ -50,10 +50,12 @@
{{/if}}
{{/if}}
{{#if topic_is_resolved}}
<i class="fa fa-check on_hover_topic_unresolve recipient_bar_icon hidden-for-spectators" data-topic-name="{{topic}}" data-tippy-content="{{t 'Mark as unresolved' }}" role="button" tabindex="0" aria-label="{{t 'Mark as unresolved' }}"></i>
{{else}}
<i class="fa fa-check on_hover_topic_resolve recipient_bar_icon hidden-for-spectators" data-topic-name="{{topic}}" data-tippy-content="{{t 'Mark as resolved' }}" role="button" tabindex="0" aria-label="{{t 'Mark as resolved' }}"></i>
{{#if user_can_resolve_topic}}
{{#if topic_is_resolved}}
<i class="fa fa-check on_hover_topic_unresolve recipient_bar_icon hidden-for-spectators" data-topic-name="{{topic}}" data-tippy-content="{{t 'Mark as unresolved' }}" role="button" tabindex="0" aria-label="{{t 'Mark as unresolved' }}"></i>
{{else}}
<i class="fa fa-check on_hover_topic_resolve recipient_bar_icon hidden-for-spectators" data-topic-name="{{topic}}" data-tippy-content="{{t 'Mark as resolved' }}" role="button" tabindex="0" aria-label="{{t 'Mark as resolved' }}"></i>
{{/if}}
{{/if}}
{{#if topic_muted}}