Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

message_list_view: Hide resolve topic option in archived channels

sandeepb630e32f1406
diff --git a/web/src/popover_menus_data.ts b/web/src/popover_menus_data.ts
index 72e4f5b6021..6f7555e26fe 100644
--- a/web/src/popover_menus_data.ts
+++ b/web/src/popover_menus_data.ts
@@ -275,7 +275,7 @@ export function get_topic_popover_content_context({
const can_rename_topic =
stream_data.user_can_move_messages_within_channel(sub) &&
!stream_data.is_empty_topic_only_channel(sub.stream_id);
- const can_resolve_topic = !sub.is_archived && stream_data.can_resolve_topics(sub);
+ const can_resolve_topic = stream_data.can_resolve_topics(sub);
const visibility_policy = user_topics.get_topic_visibility_policy(sub.stream_id, topic_name);
const all_visibility_policies = user_topics.all_visibility_policies;
diff --git a/web/src/stream_data.ts b/web/src/stream_data.ts
index 4e3c039f970..7e87cb77f5c 100644
--- a/web/src/stream_data.ts
+++ b/web/src/stream_data.ts
@@ -812,6 +812,10 @@ export function can_subscribe_others(sub: StreamSubscription): boolean {
}
export function can_resolve_topics(sub: StreamSubscription | undefined): boolean {
+ if (sub?.is_archived) {
+ return false;
+ }
+
if (settings_data.user_can_resolve_topic()) {
return true;
}
diff --git a/web/tests/stream_data.test.cjs b/web/tests/stream_data.test.cjs
index 27938a58da0..8a9ead9fcfa 100644
--- a/web/tests/stream_data.test.cjs
+++ b/web/tests/stream_data.test.cjs
@@ -1643,6 +1643,13 @@ test("can_resolve_topics", ({override}) => {
can_resolve_topics_group: admins_group.id,
};
stream_data.add_sub_for_tests(sub);
+ const archived_sub = {
+ name: "Archived",
+ stream_id: 99,
+ is_archived: true,
+ can_resolve_topics_group: admins_group.id,
+ };
+ stream_data.add_sub_for_tests(archived_sub);
assert.equal(stream_data.can_resolve_topics(undefined), false);
initialize_and_override_current_user(admin_user_id, override);
@@ -1666,6 +1673,8 @@ test("can_resolve_topics", ({override}) => {
assert.equal(stream_data.can_resolve_topics(sub), true);
initialize_and_override_current_user(test_user.user_id, override);
assert.equal(stream_data.can_resolve_topics(sub), true);
+ initialize_and_override_current_user(admin_user_id, override);
+ assert.equal(stream_data.can_resolve_topics(archived_sub), false);
});
test("can_unsubscribe_others", ({override}) => {