diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.ts index f9be4661b4..034f76b13c 100644 --- a/web/src/inbox_ui.ts +++ b/web/src/inbox_ui.ts @@ -110,6 +110,7 @@ const stream_context_properties: (keyof StreamContext)[] = [ type TopicContext = { is_topic: boolean; stream_id: number; + stream_archived: boolean; topic_name: string; topic_display_name: string; is_empty_string_topic: boolean; @@ -128,6 +129,7 @@ type TopicContext = { const topic_context_properties: (keyof TopicContext)[] = [ "is_topic", "stream_id", + "stream_archived", "topic_name", "topic_display_name", "is_empty_string_topic", @@ -409,11 +411,18 @@ function update_stream_data( ): void { const stream_topics_data = new Map(); const stream_data = format_stream(stream_id); + const stream_archived = stream_data.is_archived; let stream_post_filter_unread_count = 0; for (const [topic, {topic_count, latest_msg_id}] of topic_dict) { const topic_key = get_topic_key(stream_id, topic); if (topic_count) { - const topic_data = format_topic(stream_id, topic, topic_count, latest_msg_id); + const topic_data = format_topic( + stream_id, + stream_archived, + topic, + topic_count, + latest_msg_id, + ); stream_topics_data.set(topic_key, topic_data); if (!topic_data.is_hidden) { stream_post_filter_unread_count += topic_data.unread_count; @@ -441,6 +450,7 @@ function rerender_stream_inbox_header_if_needed( function format_topic( stream_id: number, + stream_archived: boolean, topic: string, topic_unread_count: number, latest_msg_id: number, @@ -448,6 +458,7 @@ function format_topic( const context = { is_topic: true, stream_id, + stream_archived, topic_name: topic, topic_display_name: util.get_final_topic_display_name(topic), is_empty_string_topic: topic === "", @@ -1307,12 +1318,14 @@ export function update(): void { const topic_keys_to_insert: string[] = []; const new_stream_data = format_stream(stream_id); + const stream_archived = new_stream_data.is_archived; for (const [topic, {topic_count, latest_msg_id}] of topic_dict) { const topic_key = get_topic_key(stream_id, topic); if (topic_count) { const old_topic_data = stream_topics_data.get(topic_key); const new_topic_data = format_topic( stream_id, + stream_archived, topic, topic_count, latest_msg_id, diff --git a/web/src/message_edit.ts b/web/src/message_edit.ts index f3b2aad5cc..65160da0fe 100644 --- a/web/src/message_edit.ts +++ b/web/src/message_edit.ts @@ -187,6 +187,10 @@ export function is_content_editable(message: Message, edit_limit_seconds_buffer return false; } + if (message.type === "stream" && stream_data.is_stream_archived(message.stream_id)) { + return false; + } + if (realm.realm_message_content_edit_limit_seconds === null) { return true; } diff --git a/web/src/popover_menus_data.ts b/web/src/popover_menus_data.ts index f274363344..f4805b1daf 100644 --- a/web/src/popover_menus_data.ts +++ b/web/src/popover_menus_data.ts @@ -51,6 +51,7 @@ type TopicPopoverContext = { stream_name: string; stream_id: number; stream_muted: boolean; + stream_archived: boolean; topic_display_name: string; is_empty_string_topic: boolean; topic_unmuted: boolean; @@ -250,8 +251,10 @@ export function get_topic_popover_content_context({ const topic_unmuted = user_topics.is_topic_unmuted(sub.stream_id, topic_name); const has_starred_messages = starred_messages.get_count_in_topic(sub.stream_id, topic_name) > 0; const has_unread_messages = num_unread_for_topic(sub.stream_id, topic_name) > 0; - const can_move_topic = settings_data.user_can_move_messages_between_streams(); - const can_rename_topic = settings_data.user_can_move_messages_to_another_topic(); + const can_move_topic = + !sub.is_archived && settings_data.user_can_move_messages_between_streams(); + const can_rename_topic = + !sub.is_archived && settings_data.user_can_move_messages_to_another_topic(); const visibility_policy = user_topics.get_topic_visibility_policy(sub.stream_id, topic_name); const all_visibility_policies = user_topics.all_visibility_policies; const is_spectator = page_params.is_spectator; @@ -260,6 +263,7 @@ export function get_topic_popover_content_context({ stream_name: sub.name, stream_id: sub.stream_id, stream_muted: sub.is_muted, + stream_archived: sub.is_archived, topic_display_name: util.get_final_topic_display_name(topic_name), is_empty_string_topic: topic_name === "", topic_unmuted, diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.ts index eba7f6d08a..ba8cb6e730 100644 --- a/web/src/recent_view_ui.ts +++ b/web/src/recent_view_ui.ts @@ -617,6 +617,7 @@ type ConversationContext = { stream_url: string; invite_only: boolean; is_web_public: boolean; + is_archived: boolean; topic: string; topic_display_name: string; is_empty_string_topic: boolean; @@ -656,6 +657,7 @@ function format_conversation(conversation_data: ConversationData): ConversationC const stream_url = hash_util.by_stream_url(stream_id); const invite_only = stream_info.invite_only; const is_web_public = stream_info.is_web_public; + const is_archived = stream_info.is_archived; // Topic info const topic = last_msg.topic; const topic_display_name = util.get_final_topic_display_name(topic); @@ -685,6 +687,7 @@ function format_conversation(conversation_data: ConversationData): ConversationC stream_url, invite_only, is_web_public, + is_archived, topic, topic_display_name, is_empty_string_topic, diff --git a/web/templates/inbox_view/inbox_row.hbs b/web/templates/inbox_view/inbox_row.hbs index 874e89d848..cd69dae945 100644 --- a/web/templates/inbox_view/inbox_row.hbs +++ b/web/templates/inbox_view/inbox_row.hbs @@ -49,7 +49,7 @@ {{#unless is_direct}}
- {{#if is_topic}} + {{#if (and is_topic (not stream_archived))}} {{#if (eq visibility_policy all_visibility_policies.FOLLOWED)}} diff --git a/web/templates/popovers/left_sidebar/left_sidebar_stream_actions_popover.hbs b/web/templates/popovers/left_sidebar/left_sidebar_stream_actions_popover.hbs index c0f9e92814..42768f7756 100644 --- a/web/templates/popovers/left_sidebar/left_sidebar_stream_actions_popover.hbs +++ b/web/templates/popovers/left_sidebar/left_sidebar_stream_actions_popover.hbs @@ -67,6 +67,7 @@ {{/if}} + {{#unless stream.is_archived}} + {{/unless}}
diff --git a/web/templates/popovers/left_sidebar/left_sidebar_topic_actions_popover.hbs b/web/templates/popovers/left_sidebar/left_sidebar_topic_actions_popover.hbs index 952408e191..dad5f12b34 100644 --- a/web/templates/popovers/left_sidebar/left_sidebar_topic_actions_popover.hbs +++ b/web/templates/popovers/left_sidebar/left_sidebar_topic_actions_popover.hbs @@ -5,30 +5,32 @@ {{!-- Group 1 --}} {{#unless is_spectator}} - -
  • -
    - - - - - {{#if (or stream_muted topic_unmuted)}} - - - {{/if}} - - - -
    -
  • + {{#unless stream_archived}} + +
  • +
    + + + + + {{#if (or stream_muted topic_unmuted)}} + + + {{/if}} + + + +
    +
  • + {{/unless}} {{/unless}} {{#if is_topic_empty}} @@ -77,7 +79,9 @@ {{!-- Group 3 --}} {{#if (or can_move_topic can_rename_topic is_realm_admin)}} - + {{#unless stream_archived}} + + {{/unless}} {{/if}} {{#if can_move_topic}} {{/if}} - {{#if is_realm_admin}} + {{#if (and is_realm_admin (not stream_archived))}}
    + {{#unless is_archived}} {{#if (eq visibility_policy all_visibility_policies.FOLLOWED)}} @@ -73,6 +74,7 @@ {{/if}} + {{/unless}}
    {{/if}} diff --git a/web/templates/recipient_row.hbs b/web/templates/recipient_row.hbs index 40c92a830a..1d7210287d 100644 --- a/web/templates/recipient_row.hbs +++ b/web/templates/recipient_row.hbs @@ -59,7 +59,7 @@ {{/if}} - {{#if is_subscribed}} + {{#if (and is_subscribed (not is_archived))}} {{#if (eq visibility_policy all_visibility_policies.FOLLOWED)}}