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.

dropdown_list_widget: Colorize stream privacy icons.

Sahil Batra9ec3608569b8
diff --git a/web/src/dropdown_list_widget.js b/web/src/dropdown_list_widget.js
index 85e4f9988cc..aecb97e6c6d 100644
--- a/web/src/dropdown_list_widget.js
+++ b/web/src/dropdown_list_widget.js
@@ -68,7 +68,7 @@ export class DropdownListWidget {
if (item.stream !== undefined) {
const stream = item.stream;
const rendered_stream_name_with_privacy_symbol_html =
- render_inline_decorated_stream_name({stream});
+ render_inline_decorated_stream_name({stream, show_colored_icon: true});
$elem.html(rendered_stream_name_with_privacy_symbol_html);
} else {
const text = this.render_text(item.name);
diff --git a/web/templates/inline_decorated_stream_name.hbs b/web/templates/inline_decorated_stream_name.hbs
index ca69dcfca4e..182dd7c5a26 100644
--- a/web/templates/inline_decorated_stream_name.hbs
+++ b/web/templates/inline_decorated_stream_name.hbs
@@ -1,8 +1,8 @@
{{! This controls whether the swatch next to streams in the left sidebar has a lock icon. }}
{{#if stream.invite_only }}
-<i class="zulip-icon zulip-icon-lock stream-privacy-type-icon" aria-hidden="true"></i> {{stream.name ~}}
+<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" aria-hidden="true"></i> {{stream.name ~}}
+<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 ~}}
{{ else }}
-<i class="zulip-icon zulip-icon-hashtag stream-privacy-type-icon"></i> {{stream.name ~}}
+<i class="zulip-icon zulip-icon-hashtag stream-privacy-type-icon" {{#if show_colored_icon}}style="color: {{stream.color}}"{{/if}}></i> {{stream.name ~}}
{{/if}}
diff --git a/web/templates/settings/dropdown_list.hbs b/web/templates/settings/dropdown_list.hbs
index 84366b0137a..58cc715cd53 100644
--- a/web/templates/settings/dropdown_list.hbs
+++ b/web/templates/settings/dropdown_list.hbs
@@ -2,7 +2,7 @@
<li class="list_item" role="presentation" data-value="{{value}}">
<a role="menuitem" tabindex="0">
{{#if stream}}
- {{> ../inline_decorated_stream_name stream=stream}}
+ {{> ../inline_decorated_stream_name stream=stream show_colored_icon=true}}
{{else}}
{{name}}
{{/if}}
diff --git a/web/tests/settings_org.test.js b/web/tests/settings_org.test.js
index 44477f7dc2a..fd72166ac63 100644
--- a/web/tests/settings_org.test.js
+++ b/web/tests/settings_org.test.js
@@ -842,8 +842,8 @@ test("misc", ({override_rewire, mock_template}) => {
assert.ok(!$("#user-avatar-upload-widget .image_upload_button").hasClass("hide"));
override_rewire(stream_settings_data, "get_streams_for_settings_page", () => [
- {name: "some_stream", stream_id: 75, invite_only: true},
- {name: "some_stream", stream_id: 42},
+ {name: "some_stream", stream_id: 75, invite_only: true, color: "red"},
+ {name: "some_stream", stream_id: 42, color: "blue"},
]);
// Set stubs for dropdown_list_widget: