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.
This commit is contained in:
YJDave 2018-03-06 00:22:18 +05:30 committed by Tim Abbott
parent eb67c46928
commit a059247398
2 changed files with 3 additions and 8 deletions

View File

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

View File

@ -33,15 +33,12 @@
</span><span class="recipient_bar_controls no-select">
{{! edit subject pencil icon }}
{{#if always_visible_topic_edit}}
<i class="icon-vector-pencil always_visible_topic_edit"></i>
<i class="icon-vector-pencil always_visible_topic_edit" {{#unless realm_allow_message_editing}}style="display: none"{{/unless}}></i>
{{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>
<i class="icon-vector-pencil on_hover_topic_edit" {{#unless realm_allow_message_editing}}style="display: none"{{/unless}}></i>
{{/if}}
{{/if}}
{{! exterior links (e.g. to a trac ticket) }}
{{#each subject_links}}
<a href="{{this}}" target="_blank" class="no-underline">