Files
zulip/web/templates/recipient_row.hbs
2025-08-12 17:40:00 -07:00

123 lines
7.7 KiB
Handlebars

{{#if is_stream}}
<div class="message_header message_header_stream right_part" data-stream-id="{{stream_id}}" data-topic-name="{{topic}}">
<div class="message-header-contents" style="background: {{recipient_bar_color}};">
{{! stream link }}
<a class="message_label_clickable narrows_by_recipient stream_label tippy-narrow-tooltip"
href="{{stream_url}}"
draggable="false"
data-tippy-content="{{t 'Go to #{display_recipient}' }}">
<span class="stream-privacy-modified-color-{{stream_id}} stream-privacy filter-icon" style="color: {{stream_privacy_icon_color}}">
{{> stream_privacy .}}
</span>
{{~! Recipient (e.g. stream/topic or topic) ~}}
<span class="message-header-stream-name">
{{~display_recipient~}}
</span>
{{#if is_archived}}
<span class="message-header-stream-archived"><i class="archived-indicator">({{t 'archived' }})</i></span>
{{/if}}
</a>
<span class="stream_topic_separator"><i class="zulip-icon zulip-icon-chevron-right"></i></span>
{{! hidden narrow icon for copy-pasting }}
<span class="copy-paste-text">&gt;</span>
{{! topic stuff }}
<span class="stream_topic">
{{! topic link }}
<a class="message_label_clickable narrows_by_topic tippy-narrow-tooltip"
draggable="false"
href="{{topic_url}}"
data-tippy-content="{{t 'Go to #{display_recipient} > {topic_display_name}' }}">
{{#if (and use_match_properties (not is_empty_string_topic))}}
<span class="stream-topic-inner">{{{match_topic_html}}}</span>
{{else}}
<span class="stream-topic-inner {{#if is_empty_string_topic}}empty-topic-display{{/if}}">{{topic_display_name}}</span>
{{/if}}
</a>
</span>
<span class="recipient_bar_controls no-select">
<span class="topic_edit hidden-for-spectators"></span>
{{! exterior links (e.g. to a trac ticket) }}
{{#each topic_links}}
{{#with this}}
{{!-- TODO: Find a way to use the icon_button component with <a> tags,
instead of copying over the icon button styles via the utility classes. --}}
<a href="{{url}}" target="_blank" rel="noopener noreferrer" class="recipient-bar-control recipient-bar-control-icon no-underline icon-button icon-button-neutral" data-tippy-content="{{t 'Open {text}' }}" aria-label="{{t 'Open {text}' }}" tabindex="0">
<i class="zulip-icon zulip-icon-external-link" aria-hidden="true"></i>
</a>
{{/with}}
{{/each}}
{{! edit topic pencil icon }}
{{#if is_topic_editable}}
{{> components/icon_button icon="pencil" intent="neutral" custom_classes="on_hover_topic_edit recipient-bar-control recipient-bar-control-icon hidden-for-spectators" data-tippy-content=(t "Edit topic") aria-label=(t "Edit topic") }}
{{/if}}
{{#if (and user_can_resolve_topic (not is_empty_string_topic))}}
{{#if topic_is_resolved}}
{{> components/icon_button icon="placeholder" intent="neutral" custom_classes="recipient-bar-control on-hover-unresolve-loading-indicator hidden-for-spectators hide" }}
{{else}}
{{> components/icon_button icon="check" intent="neutral" custom_classes="on_hover_topic_resolve recipient-bar-control recipient-bar-control-icon hidden-for-spectators" data-tippy-content=(t "Mark as resolved") aria-label=(t "Mark as resolved") }}
{{/if}}
{{/if}}
{{! visibility policy menu }}
{{#if (and is_subscribed (not is_archived))}}
{{!-- We define the change_visibility_policy class in a wrapper span
since the icon button component already has a tippy tooltip attached
to it and Tippy does not support multiple tooltips on a single element. --}}
<span class="change_visibility_policy recipient-bar-control hidden-for-spectators" aria-haspopup="true">
{{#if (eq visibility_policy all_visibility_policies.FOLLOWED)}}
{{> components/icon_button icon="follow" intent="neutral" custom_classes="recipient-bar-control-icon" data-tippy-content=(t "You follow this topic.") aria-label=(t "You follow this topic.") }}
{{else if (eq visibility_policy all_visibility_policies.UNMUTED)}}
{{> components/icon_button icon="unmute" intent="neutral" custom_classes="recipient-bar-control recipient-bar-control-icon" data-tippy-content=(t "You have unmuted this topic.") aria-label=(t "You have unmuted this topic.") }}
{{else if (eq visibility_policy all_visibility_policies.MUTED)}}
{{> components/icon_button icon="mute" intent="neutral" custom_classes="recipient-bar-control-icon" data-tippy-content=(t "You have muted this topic.") aria-label=(t "You have muted this topic.") }}
{{else}}
{{> components/icon_button icon="inherit" intent="neutral" custom_classes="recipient-bar-control-icon" data-tippy-content=(t "Notifications are based on your configuration for this channel.") aria-label=(t "Notifications are based on your configuration for this channel.") }}
{{/if}}
</span>
{{/if}}
{{! Topic menu }}
{{!-- We define the recipient-row-topic-menu class in a wrapper span
since the icon button component already has a tippy tooltip attached
to it and attaching the topic actions menu popover to it causes buggy behavior. --}}
<span class="recipient-row-topic-menu recipient-bar-control" aria-haspopup="true">
{{> components/icon_button icon="more-vertical" intent="neutral" custom_classes="recipient-bar-control-icon" data-tippy-content=(t "Topic actions") aria-label=(t "Topic actions") }}
</span>
</span>
<span class="recipient_row_date {{#if (and (not always_display_date) date_unchanged )}}recipient_row_date_unchanged{{/if}}">{{{date_html}}}</span>
</div>
</div>
{{else}}
<div class="message_header message_header_private_message">
<div class="message-header-contents">
<a class="message_label_clickable narrows_by_recipient stream_label tippy-narrow-tooltip"
href="{{pm_with_url}}"
draggable="false"
data-tippy-content="{{#if is_dm_with_self}}{{t 'Go to direct messages with yourself' }}{{else}}{{t 'Go to direct messages with {display_reply_to_for_tooltip}' }}{{/if}}">
<span class="private_message_header_icon"><i class="zulip-icon zulip-icon-user"></i></span>
<span class="private_message_header_name">
{{#if is_dm_with_self}}
{{t 'Messages with yourself' }}
{{else}}
{{~#tr}}You and <z-user-names></z-user-names>
{{#*inline "z-user-names"}}
{{#each recipient_users}}
{{~full_name}}{{#if is_bot}}<i class="zulip-icon zulip-icon-bot" aria-label="{{t 'Bot' }}"></i>{{/if~}}
{{#if should_add_guest_user_indicator}}&nbsp;<i>({{t 'guest'}})</i>{{/if}}{{#unless @last}}, {{/unless}}
{{/each}}
{{/inline}}
{{/tr~}}
{{/if}}
</span>
</a>
<span class="recipient_row_date {{#if (and (not always_display_date) date_unchanged )}}recipient_row_date_unchanged{{/if}}">{{{date_html}}}</span>
</div>
</div>
{{/if}}