drafts: Use generic template to show stream icon.

This commit is contained in:
Aman Agrawal
2023-04-07 21:01:35 +00:00
committed by Tim Abbott
parent 12ac459379
commit ff6d04f88c
2 changed files with 17 additions and 6 deletions

View File

@@ -339,6 +339,8 @@ export function format_draft(draft) {
const id = draft.id;
let formatted;
const time = new Date(draft.updatedAt);
let invite_only = false;
let is_web_public = false;
let time_stamp = timerender.render_now(time).time_str;
if (time_stamp === $t({defaultMessage: "Today"})) {
time_stamp = timerender.stringify_time(time);
@@ -350,12 +352,17 @@ export function format_draft(draft) {
let stream_name = draft.stream.length > 0 ? draft.stream : space_string;
if (draft.stream_id) {
const sub = sub_store.get(draft.stream_id);
if (sub && sub.name !== stream_name) {
if (sub) {
invite_only = sub.invite_only;
is_web_public = sub.is_web_public;
if (sub.name !== stream_name) {
stream_name = sub.name;
draft.stream = stream_name;
draft_model.editDraft(id, draft);
}
}
}
const draft_topic = draft.topic || compose.empty_topic_placeholder();
const draft_stream_color = stream_data.get_color(stream_name);
@@ -368,6 +375,8 @@ export function format_draft(draft) {
topic: draft_topic,
raw_content: draft.content,
time_stamp,
invite_only,
is_web_public,
};
} else {
const emails = util.extract_pm_recipients(draft.private_message_recipient);

View File

@@ -3,8 +3,10 @@
{{#if is_stream}}
<div class="message_header message_header_stream">
<div class="message-header-contents">
<div class="message_label_clickable stream_label {{dark_background}}"
style="background: {{stream_color}}; border-left-color: {{stream_color}};">
<div class="message_label_clickable stream_label">
<span class="stream-privacy filter-icon">
{{> stream_privacy}}
</span>
{{stream_name}}
</div>