zulip/static/templates/single_message.handlebars

98 lines
6.7 KiB
Handlebars
Raw Normal View History

<div zid="{{msg/id}}" id="{{table_name}}{{msg/id}}"
class="message_row{{^msg/is_stream}} private-message{{/msg/is_stream}}{{#include_sender}} include-sender{{/include_sender}}{{#contains_mention}} mention{{/contains_mention}}{{#include_footer}} last_message{{/include_footer}}{{#msg.unread}} unread{{/msg.unread}} {{#if msg.locally_echoed}}local{{/if}} selectable_row"
role="listitem">
<div class="unread_marker"><div class="unread-marker-fill"></div></div>
<div class="messagebox{{^include_sender}} prev_is_same_sender{{/include_sender}}{{^msg/is_stream}} private-message{{/msg/is_stream}} {{#if next_is_same_sender}}next_is_same_sender{{/if}}"
style="box-shadow: inset 2px 0px 0px 0px {{#if msg/is_stream}}{{background_color}}{{else}}#444444{{/if}}, -1px 0px 0px 0px {{#if msg/is_stream}}{{background_color}}{{else}}#444444{{/if}};">
<div class="messagebox-border">
<div class="messagebox-content">
<div class="message_top_line">
<span class="message_sender{{^status_message}} sender_info_hover{{/status_message}} no-select">
{{#include_sender}}
{{! See ../js/notifications.js for another user of avatar_url. }}
<div class="u-{{msg/sender_id}} inline_profile_picture{{#status_message}} sender_info_hover{{/status_message}}" aria-hidden="true">
<img src="{{small_avatar_url}}" alt="" class="no-drag{{#if sender_is_guest}} guest_user_avatar{{/if}}"/>
</div>
{{#if status_message}}
<span class="sender-status">
<span class="sender_name-in-status sender_info_hover auto-select" role="button" tabindex="0">{{msg/sender_full_name}}</span>
{{#if sender_is_bot}}
<i class="zulip-icon bot" aria-label="{{t 'Bot' }}"></i>
{{/if}}
<span class="status-message auto-select">
{{{ status_message }}}
</span>
{{#if_and last_edit_timestr include_sender}}
<div class="message_edit_notice auto-select" title="{{#tr this}}Edited (__last_edit_timestr__){{/tr}}">
({{t "EDITED" }})
</div>
{{/if_and}}
</span>
{{else}}
<span class="sender_name auto-select" role="button" tabindex="0">{{msg/sender_full_name}}</span>
{{#if sender_is_bot}}
<i class="zulip-icon bot" aria-label="{{t 'Bot' }}"></i>
{{/if}}
{{/if}}
{{/include_sender}}
</span>
<span class="alert-msg pull-right"></span>
<span class="message_time{{#if msg.locally_echoed}} notvisible{{/if}}{{#if status_message}} status-time{{/if}}">
{{#unless include_sender}}
<span class="copy-paste-text">&nbsp;</span>
{{/unless}}
{{timestr}}
</span>
{{#if_and last_edit_timestr include_sender}}
{{#unless status_message}}
<div class="message_edit_notice" title="{{#tr this}}Edited (__last_edit_timestr__){{/tr}}">
({{t "EDITED" }})
</div>
{{/unless}}
{{/if_and}}
<div class="message_controls{{#status_message}} sender-status-controls{{/status_message}} no-select">
{{#if msg/sent_by_me}}
<div class="edit_content"></div>
{{else}}
<div class="reaction_button">
<i class="fa fa-smile-o" title="{{#tr this}}Add emoji reaction{{/tr}} (:)" aria-label="{{#tr this}}Add emoji reaction{{/tr}} (:)" role="button" aria-haspopup="true" tabindex="0"></i>
</div>
{{/if}}
{{#unless msg/locally_echoed}}
<div class="info actions_hover">
<i class="fa fa-chevron-down" title="{{#tr this}}Message actions{{/tr}} (i)" title="{{#tr this}}Message actions{{/tr}}" role="button" aria-haspopup="true" tabindex="0" aria-label="{{#tr this}}Message actions{{/tr}}"></i>
</div>
{{/unless}}
<div class="message_failed {{#unless msg.failed_request}}notvisible{{/unless}}">
<i class="fa fa-refresh refresh-failed-message" data-toggle="tooltip" title="{{t 'Retry' }}" aria-label="{{t 'Retry' }}" role="button" tabindex="0"></i>
<i class="fa fa-times-circle remove-failed-message" aria-hidden="true" data-toggle="tooltip" title="{{t 'Cancel' }}"></i>
</div>
Simplify/unify starring messages from the frontend. We now do all of the main logic for starring/unstarring a message in `message_flags.toggle_starred`: * mark the message as read (just in case) * update the UI (i.e. the green star in the message) * update the server The calling code in both the click handler and the hotkey handler remains simple--they just handle minor details like finding the message and clearing popovers. For updating the server, we now call the new `send_flag_update` helper. And we continue to delegate some of the logic to `ui.update_starred`, but we remove some code there that's now pushed up to `message_flags.toggle_starred`. This change should be mostly transparent to users, but it does remove some inconsistent behaviors between the click handler and the hotkey handler. Before this change, the click handler was more aggressive about updating the UI and marking the message as read. For people using the "*" key to star/unstar, they probably would only have noticed different behavior on a slow connection or in an edge case scenario where only half of the message was onscreen. More importantly, by simplifying how we talk to the server, this eliminated up to a one-second lag due to the debounce logic in the batch_updater code. The complicated debounce logic is only really needed for batch-updating "read" messages, and it was overkill and sluggish for starring messages. Last but not least, we add defensive code for the local echo case. (Users have to wait till the message gets acked to star it.)
2017-12-16 13:33:54 +01:00
{{#unless msg/locally_echoed}}
<div class="star fa {{#if msg/starred}}fa-star{{else}}fa-star-o{{/if}} {{#if msg/starred}}{{else}}empty-star{{/if}}" title="{{#tr this.msg}}__starred_status__ this message{{/tr}} (*)">
</div>
Simplify/unify starring messages from the frontend. We now do all of the main logic for starring/unstarring a message in `message_flags.toggle_starred`: * mark the message as read (just in case) * update the UI (i.e. the green star in the message) * update the server The calling code in both the click handler and the hotkey handler remains simple--they just handle minor details like finding the message and clearing popovers. For updating the server, we now call the new `send_flag_update` helper. And we continue to delegate some of the logic to `ui.update_starred`, but we remove some code there that's now pushed up to `message_flags.toggle_starred`. This change should be mostly transparent to users, but it does remove some inconsistent behaviors between the click handler and the hotkey handler. Before this change, the click handler was more aggressive about updating the UI and marking the message as read. For people using the "*" key to star/unstar, they probably would only have noticed different behavior on a slow connection or in an edge case scenario where only half of the message was onscreen. More importantly, by simplifying how we talk to the server, this eliminated up to a one-second lag due to the debounce logic in the batch_updater code. The complicated debounce logic is only really needed for batch-updating "read" messages, and it was overkill and sluggish for starring messages. Last but not least, we add defensive code for the local echo case. (Users have to wait till the message gets acked to star it.)
2017-12-16 13:33:54 +01:00
{{/unless}}
</div>
</div>
<div class="message_content">{{#unless status_message}}{{#if use_match_properties}}{{{msg/match_content}}}{{else}}{{{msg/content}}}{{/if}}{{/unless}}</div>
{{#if last_edit_timestr}}
{{#unless include_sender}}
<div class="message_edit_notice auto-select" title="{{#tr this}}Edited (__last_edit_timestr__){{/tr}}">
({{t "EDITED" }})
</div>
{{/unless}}
{{/if}}
<div class="message_edit">
<div class="message_edit_form"></div>
</div>
<div class="message_expander message_length_controller" title="{{t 'See the rest of this message' }}">{{t "[More...]" }}</div>
<div class="message_condenser message_length_controller" title="{{t 'Make this message take up less space on the screen' }}">{{t "[Condense this message]" }}</div>
<div class="message_reactions">{{ partial "message_reactions" }}</div>
</div>
</div>
</div>
</div>