Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
stream_privacy: Use new lock and hashtag icons.
Aman Agrawal8c744752ed55
diff --git a/help/stream-permissions.md b/help/stream-permissions.mdindex 25b21094a20..4a13c2fcfc9 100644--- a/help/stream-permissions.md+++ b/help/stream-permissions.md@@ -3,14 +3,15 @@Streams are similar to chat rooms, IRC channels, or email lists in that theydetermine who receives a message. Zulip supports a few types of streams:-* **Public** (**#**): Members can join and view the complete message history.+* **Public** (<i class="zulip-icon zulip-icon-hashtag"></i>):+ Members can join and view the complete message history.Public streams are visible to guest users only if they aresubscribed (exactly like private streams with shared history).-* **Private** (<i class="fa fa-lock"></i>): New subscribers must be- added by an existing subscriber. Only subscribers and organization- administrators can see the stream's name and description, and only- subscribers can view topics and messages with the stream:+* **Private** (<i class="zulip-icon zulip-icon-lock"></i>):+ New subscribers must be added by an existing subscriber. Only subscribers+ and organization administrators can see the stream's name and description,+ and only subscribers can view topics and messages with the stream:* In **private streams with shared history**, new subscribers canaccess the stream's full message history.* In **private streams with protected history**, new subscribersdiff --git a/tools/tests/test_pretty_print.py b/tools/tests/test_pretty_print.pyindex b6cd95dc093..1766e66620d 100644--- a/tools/tests/test_pretty_print.py+++ b/tools/tests/test_pretty_print.py@@ -163,7 +163,7 @@ BAD_HTML7 = """<div class="foobar"><input type="foobar" name="temp" value="{{dyn_name}}"{{#unless invite_only}}checked="checked"{{/unless}} /> {{dyn_name}}-{{#if invite_only}}<i class="fa fa-lock"></i>{{/if}}+{{#if invite_only}}<i class="zulip-icon zulip-icon-lock"></i>{{/if}}</div>"""@@ -171,7 +171,7 @@ GOOD_HTML7 = """<div class="foobar"><input type="foobar" name="temp" value="{{dyn_name}}"{{#unless invite_only}}checked="checked"{{/unless}} /> {{dyn_name}}- {{#if invite_only}}<i class="fa fa-lock"></i>{{/if}}+ {{#if invite_only}}<i class="zulip-icon zulip-icon-lock"></i>{{/if}}</div>"""diff --git a/web/shared/icons/hashtag.svg b/web/shared/icons/hashtag.svgnew file mode 100644index 00000000000..7a50562cfc0--- /dev/null+++ b/web/shared/icons/hashtag.svg@@ -0,0 +1,6 @@+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">+<title></title>+<g id="icomoon-ignore">+</g>+<path fill="#000" d="M365.714 0c40.395 0 73.143 32.747 73.143 73.143v219.429h146.286v-219.429c0-40.396 32.747-73.143 73.143-73.143s73.143 32.747 73.143 73.143v219.429h219.429c40.397 0 73.143 32.748 73.143 73.143s-32.746 73.143-73.143 73.143h-219.429v146.286h219.429c40.397 0 73.143 32.747 73.143 73.143s-32.746 73.143-73.143 73.143h-219.429v219.429c0 40.397-32.747 73.143-73.143 73.143s-73.143-32.746-73.143-73.143v-219.429h-146.286v219.429c0 40.397-32.748 73.143-73.143 73.143s-73.143-32.746-73.143-73.143v-219.429h-219.429c-40.396 0-73.143-32.747-73.143-73.143s32.747-73.143 73.143-73.143h219.429v-146.286h-219.429c-40.396 0-73.143-32.748-73.143-73.143s32.747-73.143 73.143-73.143h219.429v-219.429c0-40.396 32.748-73.143 73.143-73.143zM585.143 585.143v-146.286h-146.286v146.286z"></path>+</svg>\ No newline at end of filediff --git a/web/shared/icons/lock.svg b/web/shared/icons/lock.svgnew file mode 100644index 00000000000..87776ac0569--- /dev/null+++ b/web/shared/icons/lock.svg@@ -0,0 +1,6 @@+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="1024" height="1024" viewBox="0 0 1024 1024">+<title></title>+<g id="icomoon-ignore">+</g>+<path fill="#000" d="M241.067 298.668c0-71.856 28.545-140.769 79.354-191.579s119.723-79.354 191.579-79.354c71.856 0 140.768 28.545 191.578 79.354s79.354 119.723 79.354 191.579v122.667h27.738c73.638 0 133.331 59.695 133.331 133.334v298.669c0 73.632-59.693 133.331-133.331 133.331h-597.336c-73.638 0-133.333-59.699-133.333-133.331v-298.669c0-73.638 59.695-133.334 133.333-133.334h27.734v-122.667zM512 142.934c-41.303 0-80.915 16.408-110.12 45.613s-45.613 68.817-45.613 110.12v122.667h311.464v-122.667c0-41.303-16.403-80.914-45.611-110.12-29.206-29.206-68.817-45.613-110.12-45.613zM544 794.541c37.286-13.184 64-48.742 64-90.541 0-53.018-42.98-95.999-96-95.999s-96 42.981-96 95.999c0 41.798 26.714 77.357 64 90.541v69.459h64v-69.459z"></path>+</svg>\ No newline at end of filediff --git a/web/src/filter.js b/web/src/filter.jsindex ec6dbc2dccf..bfdd4cdf03b 100644--- a/web/src/filter.js+++ b/web/src/filter.js@@ -626,36 +626,47 @@ export class Filter {return "#"; // redirect to All}- get_icon() {+ add_icon_data(context) {// We have special icons for the simple narrows available for the via sidebars.const term_types = this.sorted_term_types();switch (term_types[0]) {case "in-home":case "in-all":- return "home";+ context.icon = "home";+ break;case "stream":if (!this._sub) {- return "question-circle-o";+ context.icon = "question-circle-o";+ break;}if (this._sub.invite_only) {- return "lock";+ context.zulip_icon = "lock";+ break;}if (this._sub.is_web_public) {- return "globe";+ context.zulip_icon = "globe";+ break;}- return "hashtag";+ context.zulip_icon = "hashtag";+ break;case "is-private":- return "envelope";+ context.icon = "envelope";+ break;case "is-starred":- return "star";+ context.icon = "star";+ break;case "is-mentioned":- return "at";+ context.icon = "at";+ break;case "pm-with":- return "envelope";+ context.icon = "envelope";+ break;case "is-resolved":- return "check";+ context.icon = "check";+ break;default:- return undefined;+ context.icon = undefined;+ break;}}diff --git a/web/src/message_view_header.js b/web/src/message_view_header.jsindex bba5bb414e9..c1b323981ca 100644--- a/web/src/message_view_header.js+++ b/web/src/message_view_header.js@@ -33,13 +33,7 @@ function make_message_view_header(filter) {};}message_view_header.title = filter.get_title();- message_view_header.icon = filter.get_icon();- if (message_view_header.icon === "globe") {- // This is a bit hacky, but it works as a way to communicate- // to the HTML template that we need to use the different HTML- // required for the globe icon.- message_view_header.web_public_stream = true;- }+ filter.add_icon_data(message_view_header);if (filter.has_operator("stream") && !filter._sub) {message_view_header.sub_count = "0";message_view_header.formatted_sub_count = "0";diff --git a/web/styles/left_sidebar.css b/web/styles/left_sidebar.cssindex 33d49828adb..011acc93a2a 100644--- a/web/styles/left_sidebar.css+++ b/web/styles/left_sidebar.css@@ -37,16 +37,24 @@ $before_unread_count_padding: 3px;position: relative;top: 1px;}++ .zulip-icon.zulip-icon-hashtag {+ font-size: 13px;+ position: relative;+ top: 1.5px;+ }++ .zulip-icon.zulip-icon-lock {+ font-size: 13px;+ }}-/* Ideally we'd handle hashtags using an <i> and just have a single rule here. */-.stream-privacy span.hashtag,#left-sidebar .filter-icon i {padding-right: 3px;- &.fa-lock {+ &.zulip-icon-lock {position: relative;- top: 1px;+ top: 2px;}}diff --git a/web/styles/recent_topics.css b/web/styles/recent_topics.cssindex 0a3880159b2..1dbf127548c 100644--- a/web/styles/recent_topics.css+++ b/web/styles/recent_topics.css@@ -66,10 +66,6 @@width: 10px;}- .fa-lock {- padding-right: 3px;- }-.fa-envelope {font-size: 0.7rem;margin-right: 2px;@@ -458,8 +454,12 @@}}- .stream-privacy .zulip-icon.zulip-icon-globe {- left: -1px;+ .stream-privacy {+ .zulip-icon {+ position: relative;+ left: -1px;+ top: 1.5px;+ }}}diff --git a/web/styles/subscriptions.css b/web/styles/subscriptions.cssindex 3111930ff4a..e08ec022f42 100644--- a/web/styles/subscriptions.css+++ b/web/styles/subscriptions.css@@ -415,10 +415,12 @@ h4.user_group_setting_subsection_title {.large-icon {display: inline-block;- }- .fa-lock {- position: relative;+ .zulip-icon {+ font-size: 20px;+ position: relative;+ top: 3px;+ }}.zulip-icon-globe {@@ -583,10 +585,6 @@ h4.user_group_setting_subsection_title {font-size: 1.1em;}- .fa-lock {- font-size: 1.4em;- }-.hashtag {font-size: 1.4em;font-weight: 600;@@ -828,9 +826,8 @@ h4.user_group_setting_subsection_title {.large-icon {display: inline-block;vertical-align: top;- margin-right: 5px;+ margin-right: 8px;margin-top: -5px;- font-size: 1.5em;&.hash::after {top: -1px;@@ -838,8 +835,10 @@ h4.user_group_setting_subsection_title {font-weight: 800;}- .zulip-icon-globe {- font-size: 15px;+ .zulip-icon {+ font-size: 18px;+ position: relative;+ top: 1px;}}diff --git a/web/styles/zulip.css b/web/styles/zulip.cssindex b4ec6d3aa4e..8d427dee1b9 100644--- a/web/styles/zulip.css+++ b/web/styles/zulip.css@@ -1168,6 +1168,15 @@ td.pointer {}}+ .stream-privacy i {+ font-size: 15px;++ &.zulip-icon-globe,+ &.zulip-icon-hashtag {+ position: relative;+ top: -0.5px;+ }+ }}}@@ -1241,7 +1250,19 @@ td.pointer {text-decoration: none;}+ .stream-privacy {+ min-width: unset;+ width: 16px;+ height: 16px;+ .hashtag {+ padding-right: 0;++ &::after {+ font-size: 16px;+ }+ }+ }}.recipient_bar_controls {@@ -1801,12 +1822,6 @@ div.focused_table {display: none;}- .zulip-icon.zulip-icon-globe {- font-size: 14px;- position: relative;- top: 1px;- }-.sub_count,.stream,& > span {@@ -1832,11 +1847,6 @@ div.focused_table {}.fa {- &.fa-lock {- position: relative;- top: 0.5px;- }-.fa-envelope {font-size: 14px;margin: 0 5px;@@ -1856,6 +1866,12 @@ div.focused_table {text-decoration: none;/* The first ~3px of padding here overlaps with the left padding from sub_count for some reason. */padding-right: calc(3px + 10px);++ .zulip-icon {+ font-size: 14px;+ position: relative;+ top: 1px;+ }}.divider {@@ -2410,7 +2426,6 @@ select.invite-as {}.date_row {- padding-left: 2px;text-align: right;}diff --git a/web/templates/navbar_icon_and_title.hbs b/web/templates/navbar_icon_and_title.hbsindex 79e76625669..d31603b4a9e 100644--- a/web/templates/navbar_icon_and_title.hbs+++ b/web/templates/navbar_icon_and_title.hbs@@ -1,5 +1,5 @@-{{#if web_public_stream}}-<i class="zulip-icon zulip-icon-globe" aria-hidden="true"></i>+{{#if zulip_icon}}+<i class="zulip-icon zulip-icon-{{zulip_icon}}" aria-hidden="true"></i>{{else if icon}}<i class="fa fa-{{icon}}" aria-hidden="true"></i>{{/if}}diff --git a/web/templates/stream_privacy.hbs b/web/templates/stream_privacy.hbsindex 1f49a3a7fa5..bebdac58ab7 100644--- a/web/templates/stream_privacy.hbs+++ b/web/templates/stream_privacy.hbs@@ -1,8 +1,8 @@{{! This controls whether the swatch next to streams in the left sidebar has a lock icon. }}{{#if invite_only}}-<i class="fa fa-lock" aria-hidden="true"></i>+<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>{{else}}-<span class="hashtag"></span>+<i class="zulip-icon zulip-icon-hashtag" aria-hidden="true"></i>{{/if}}diff --git a/web/templates/stream_settings/stream_privacy_icon.hbs b/web/templates/stream_settings/stream_privacy_icon.hbsindex 83b45cd8e72..1e9f4d8b596 100644--- a/web/templates/stream_settings/stream_privacy_icon.hbs+++ b/web/templates/stream_settings/stream_privacy_icon.hbs@@ -1,12 +1,14 @@{{! This controls whether the swatch next to streams in the stream edit page has a lock icon. }}{{#if invite_only}}-<div class="large-icon lock" style="color: {{color}}">- <i class="fa fa-lock" aria-hidden="true"></i>+<div class="large-icon" style="color: {{color}}">+ <i class="zulip-icon zulip-icon-lock" aria-hidden="true"></i></div>{{else if is_web_public}}<div class="large-icon" style="color: {{color}}"><i class="zulip-icon zulip-icon-globe" aria-hidden="true"></i></div>{{else}}-<div class="large-icon hash" style="color: {{color}}"></div>+<div class="large-icon" style="color: {{color}}">+ <i class="zulip-icon zulip-icon-hashtag" aria-hidden="true"></i>+</div>{{/if}}diff --git a/web/templates/stream_settings/subscription_setting_icon.hbs b/web/templates/stream_settings/subscription_setting_icon.hbsindex 8077d4df8d0..8a3cb123cc5 100644--- a/web/templates/stream_settings/subscription_setting_icon.hbs+++ b/web/templates/stream_settings/subscription_setting_icon.hbs@@ -1,11 +1,11 @@<div class="icon" style="background-color: {{color}}"><div class="flex">{{#if invite_only}}- <i class="fa fa-lock" aria-hidden="true"></i>+ <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>{{else}}- <span class="hashtag">#</span>+ <span class="zulip-icon zulip-icon-hashtag"></span>{{/if}}</div></div>diff --git a/web/tests/filter.test.js b/web/tests/filter.test.jsindex 4417a566d8f..a9568be37de 100644--- a/web/tests/filter.test.js+++ b/web/tests/filter.test.js@@ -1437,9 +1437,12 @@ test("navbar_helpers", () => {assert.equal(filter.is_common_narrow(), test_case.is_common_narrow);}- function test_get_icon(test_case) {+ function test_add_icon_data(test_case) {const filter = new Filter(test_case.operator);- assert.equal(filter.get_icon(), test_case.icon);+ const context = {};+ filter.add_icon_data(context);+ assert.equal(context.icon, test_case.icon);+ assert.equal(context.zulip_icon, test_case.zulip_icon);}function test_get_title(test_case) {@@ -1450,7 +1453,7 @@ test("navbar_helpers", () => {function test_helpers(test_case) {// debugging tip: add a `console.log(test_case)` heretest_common_narrow(test_case);- test_get_icon(test_case);+ test_add_icon_data(test_case);test_get_title(test_case);test_redirect_url_with_search(test_case);}@@ -1541,7 +1544,7 @@ test("navbar_helpers", () => {{operator: stream_topic_operators,is_common_narrow: true,- icon: "hashtag",+ zulip_icon: "hashtag",title: "Foo",redirect_url_with_search: "/#narrow/stream/43-Foo/topic/bar",},@@ -1555,7 +1558,7 @@ test("navbar_helpers", () => {{operator: stream_operator,is_common_narrow: true,- icon: "hashtag",+ zulip_icon: "hashtag",title: "Foo",redirect_url_with_search: "/#narrow/stream/43-Foo",},@@ -1576,14 +1579,14 @@ test("navbar_helpers", () => {{operator: private_stream_operator,is_common_narrow: true,- icon: "lock",+ zulip_icon: "lock",title: "psub",redirect_url_with_search: "/#narrow/stream/22-psub",},{operator: web_public_stream_operator,is_common_narrow: true,- icon: "globe",+ zulip_icon: "globe",title: "webPublicSub",redirect_url_with_search: "/#narrow/stream/12-webPublicSub",},@@ -1631,7 +1634,7 @@ test("navbar_helpers", () => {{operator: stream_topic_near,is_common_narrow: false,- icon: "hashtag",+ zulip_icon: "hashtag",title: "Foo",redirect_url_with_search: "#",},