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.

stream_privacy: Add archive icon for archived channels.

sanchi-t423ee27a2351
diff --git a/web/src/filter.ts b/web/src/filter.ts
index 9150f9f88f8..a495535eee9 100644
--- a/web/src/filter.ts
+++ b/web/src/filter.ts
@@ -1325,6 +1325,10 @@ export class Filter {
icon = "question-circle-o";
break;
}
+ if (sub.is_archived) {
+ zulip_icon = "archive";
+ break;
+ }
if (sub.invite_only) {
zulip_icon = "lock";
break;
diff --git a/web/styles/app_components.css b/web/styles/app_components.css
index 988db07f1eb..9f1d4b97316 100644
--- a/web/styles/app_components.css
+++ b/web/styles/app_components.css
@@ -962,6 +962,7 @@ input.settings_text_input {
width: 12px;
&.zulip-icon-globe,
+ &.zulip-icon-archive,
&.zulip-icon-hashtag {
font-size: 0.75em;
}
diff --git a/web/templates/inline_decorated_stream_name.hbs b/web/templates/inline_decorated_stream_name.hbs
index 561049e95ec..9f943c19ea1 100644
--- a/web/templates/inline_decorated_stream_name.hbs
+++ b/web/templates/inline_decorated_stream_name.hbs
@@ -1,5 +1,7 @@
{{! This controls whether the swatch next to streams in the left sidebar has a lock icon. }}
-{{~#if stream.invite_only ~}}
+{{~#if stream.is_archived ~}}
+<i class="zulip-icon zulip-icon-archive stream-privacy-type-icon" {{#if show_colored_icon}}style="color: {{stream.color}}"{{/if}} aria-hidden="true"></i> {{stream.name ~}}
+{{~ else if stream.invite_only ~}}
<i class="zulip-icon zulip-icon-lock stream-privacy-type-icon" {{#if show_colored_icon}}style="color: {{stream.color}}"{{/if}} aria-hidden="true"></i> {{stream.name ~}}
{{~ else if stream.is_web_public ~}}
<i class="zulip-icon zulip-icon-globe stream-privacy-type-icon" {{#if show_colored_icon}}style="color: {{stream.color}}"{{/if}} aria-hidden="true"></i> {{stream.name ~}}
diff --git a/web/templates/popovers/stream_card_popover.hbs b/web/templates/popovers/stream_card_popover.hbs
index 05cd17a5306..8f59dca0ae9 100644
--- a/web/templates/popovers/stream_card_popover.hbs
+++ b/web/templates/popovers/stream_card_popover.hbs
@@ -4,7 +4,8 @@
<span class="stream-privacy-original-color-{{stream.stream_id}} stream-privacy filter-icon" style="color: {{stream.color}}">
{{> ../stream_privacy
invite_only=stream.invite_only
- is_web_public=stream.is_web_public }}
+ is_web_public=stream.is_web_public
+ is_archived=stream.is_archived }}
</span>
<span class="popover-stream-name">{{stream.name}}</span>
</li>
diff --git a/web/templates/stream_privacy.hbs b/web/templates/stream_privacy.hbs
index bebdac58ab7..21c877cd6b5 100644
--- a/web/templates/stream_privacy.hbs
+++ b/web/templates/stream_privacy.hbs
@@ -1,5 +1,7 @@
{{! This controls whether the swatch next to streams in the left sidebar has a lock icon. }}
-{{#if invite_only}}
+{{#if is_archived}}
+<i class="zulip-icon zulip-icon-archive" aria-hidden="true"></i>
+{{else if invite_only}}
<i class="zulip-icon zulip-icon-lock" aria-hidden="true"></i>
{{else if is_web_public}}
<i class="zulip-icon zulip-icon-globe" aria-hidden="true"></i>
diff --git a/web/templates/stream_settings/selected_stream_title.hbs b/web/templates/stream_settings/selected_stream_title.hbs
index ac292053fb3..4755dca4cc0 100644
--- a/web/templates/stream_settings/selected_stream_title.hbs
+++ b/web/templates/stream_settings/selected_stream_title.hbs
@@ -2,6 +2,7 @@
{{#unless preview_url}}{{t "Add subscribers to "}}{{/unless}}
{{> stream_privacy_icon
invite_only=sub.invite_only
- is_web_public=sub.is_web_public }}
+ is_web_public=sub.is_web_public
+ is_archived=sub.is_archived }}
<span class="stream-name-title">{{sub.name}}</span>
</a>
diff --git a/web/templates/stream_settings/stream_privacy_icon.hbs b/web/templates/stream_settings/stream_privacy_icon.hbs
index d7baf062d98..9a27ab69c69 100644
--- a/web/templates/stream_settings/stream_privacy_icon.hbs
+++ b/web/templates/stream_settings/stream_privacy_icon.hbs
@@ -1,5 +1,9 @@
{{! This controls whether the swatch next to streams in the stream edit page has a lock icon. }}
-{{#if invite_only}}
+{{#if is_archived}}
+<div class="large-icon" {{#if title_icon_color}}style="color: {{title_icon_color}}{{/if}}">
+ <i class="zulip-icon zulip-icon-archive" aria-hidden="true"></i>
+</div>
+{{else if invite_only}}
<div class="large-icon" {{#if title_icon_color}}style="color: {{title_icon_color}}"{{/if}}>
<i class="zulip-icon zulip-icon-lock" aria-hidden="true"></i>
</div>
diff --git a/web/templates/stream_settings/subscription_setting_icon.hbs b/web/templates/stream_settings/subscription_setting_icon.hbs
index 8a3cb123cc5..215fe5396a2 100644
--- a/web/templates/stream_settings/subscription_setting_icon.hbs
+++ b/web/templates/stream_settings/subscription_setting_icon.hbs
@@ -1,6 +1,8 @@
<div class="icon" style="background-color: {{color}}">
<div class="flex">
- {{#if invite_only}}
+ {{#if is_archived}}
+ <i class="zulip-icon zulip-icon-archive fa-lg" aria-hidden="true"></i>
+ {{else if invite_only}}
<i class="zulip-icon zulip-icon-lock" aria-hidden="true"></i>
{{else if is_web_public}}
<i class="zulip-icon zulip-icon-globe fa-lg" aria-hidden="true"></i>
diff --git a/web/tests/filter.test.cjs b/web/tests/filter.test.cjs
index e8eba6d5080..d61f5f7a044 100644
--- a/web/tests/filter.test.cjs
+++ b/web/tests/filter.test.cjs
@@ -2094,6 +2094,15 @@ function make_web_public_sub(name, stream_id) {
stream_data.add_sub(sub);
}
+function make_archived_sub(name, stream_id) {
+ const sub = {
+ name,
+ stream_id,
+ is_archived: true,
+ };
+ stream_data.add_sub(sub);
+}
+
test("navbar_helpers", ({override}) => {
stream_data.add_sub(foo_sub);
@@ -2185,6 +2194,9 @@ test("navbar_helpers", ({override}) => {
const web_public_sub_id = new_stream_id();
make_web_public_sub("webPublicSub", web_public_sub_id); // capitalized just to try be tricky and robust.
const web_public_channel = [{operator: "channel", operand: web_public_sub_id.toString()}];
+ const archived_sub_id = new_stream_id();
+ make_archived_sub("archivedSub", archived_sub_id);
+ const archived_channel_term = [{operator: "channel", operand: archived_sub_id.toString()}];
const dm = [{operator: "dm", operand: "[email protected]"}];
const dm_with = [
{operator: "dm", operand: "[email protected]"},
@@ -2343,6 +2355,13 @@ test("navbar_helpers", ({override}) => {
title: "webPublicSub",
redirect_url_with_search: `/#narrow/channel/${web_public_sub_id}-webPublicSub`,
},
+ {
+ terms: archived_channel_term,
+ is_common_narrow: true,
+ zulip_icon: "archive",
+ title: "archivedSub",
+ redirect_url_with_search: `/#narrow/channel/${archived_sub_id}-archivedSub`,
+ },
{
terms: dm,
is_common_narrow: true,