mirror of https://github.com/zulip/zulip.git
local echo: Don't show collapse/uncollapse items.
Trying to collapse a locally echoed message is a rare thing to do, and it was buggy before this due to races between the server acking the original message and the user flipping the collapsed flag. We now calculate `should_display_collapse` and `should_display_uncollapse` in the JS code and simplify the template by eliminating all the inline if/else logic. (Note that we are about to disable the message menu altogether for locally echoed messages, so this change is partly future-proofing for when we put the menu back for more innocuous commands.)
This commit is contained in:
parent
f84a49cee6
commit
94da59ff81
|
@ -174,12 +174,18 @@ exports.toggle_actions_popover = function (element, id) {
|
|||
}) && page_params.realm_allow_edit_history;
|
||||
var should_display_delete_option = page_params.is_admin ||
|
||||
(message.sent_by_me && page_params.realm_allow_message_deleting);
|
||||
|
||||
var should_display_collapse = !message.locally_echoed && !message.collapsed;
|
||||
var should_display_uncollapse = !message.locally_echoed && message.collapsed;
|
||||
|
||||
var args = {
|
||||
message: message,
|
||||
use_edit_icon: use_edit_icon,
|
||||
editability_menu_item: editability_menu_item,
|
||||
can_mute_topic: can_mute_topic,
|
||||
can_unmute_topic: can_unmute_topic,
|
||||
should_display_collapse: should_display_collapse,
|
||||
should_display_uncollapse: should_display_uncollapse,
|
||||
should_display_add_reaction_option: message.sent_by_me,
|
||||
should_display_edit_history_option: should_display_edit_history_option,
|
||||
conversation_time_uri: narrow.by_conversation_and_time_uri(message, true),
|
||||
|
|
|
@ -13,12 +13,24 @@
|
|||
</a>
|
||||
</li>
|
||||
|
||||
|
||||
{{#if should_display_collapse}}
|
||||
<li>
|
||||
<a href="#" class="popover_toggle_collapse" data-message-id="{{message.id}}">
|
||||
<i class="{{#if message.collapsed}}fa fa-plus{{else}}fa fa-minus{{/if}}" aria-hidden="true"></i>
|
||||
{{#if message.collapsed}}{{t "Un-collapse" }}{{else}}{{t "Collapse" }}{{/if}} (-)
|
||||
<i class="fa fa-minus" aria-hidden="true"></i>
|
||||
{{t "Collapse" }} (-)
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if should_display_uncollapse}}
|
||||
<li>
|
||||
<a href="#" class="popover_toggle_collapse" data-message-id="{{message.id}}">
|
||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
||||
{{t "Un-collapse" }} (-)
|
||||
</a>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
{{#if should_display_edit_history_option}}
|
||||
<li>
|
||||
|
|
Loading…
Reference in New Issue