Skip to content

Commit

Permalink
stream_privacy: Use new lock and hashtag icons.
Browse files Browse the repository at this point in the history
This commit doesn't modify the lock and hashtag icon in settings.
  • Loading branch information
amanagr committed Apr 8, 2023
1 parent 3f830fe commit c4e16e7
Show file tree
Hide file tree
Showing 15 changed files with 121 additions and 76 deletions.
11 changes: 6 additions & 5 deletions help/stream-permissions.md
Expand Up @@ -3,14 +3,15 @@
Streams are similar to chat rooms, IRC channels, or email lists in that they
determine 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 are
subscribed (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 can
access the stream's full message history.
* In **private streams with protected history**, new subscribers
Expand Down
4 changes: 2 additions & 2 deletions tools/tests/test_pretty_print.py
Expand Up @@ -163,15 +163,15 @@
<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>
"""

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>
"""

Expand Down
6 changes: 6 additions & 0 deletions web/shared/icons/hashtag.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions web/shared/icons/lock.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 23 additions & 12 deletions web/src/filter.js
Expand Up @@ -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;
}
}

Expand Down
8 changes: 1 addition & 7 deletions web/src/message_view_header.js
Expand Up @@ -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";
Expand Down
16 changes: 12 additions & 4 deletions web/styles/left_sidebar.css
Expand Up @@ -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;
}
}

Expand Down
12 changes: 6 additions & 6 deletions web/styles/recent_topics.css
Expand Up @@ -66,10 +66,6 @@
width: 10px;
}

.fa-lock {
padding-right: 3px;
}

.fa-envelope {
font-size: 0.7rem;
margin-right: 2px;
Expand Down Expand Up @@ -458,8 +454,12 @@
}
}

.stream-privacy .zulip-icon.zulip-icon-globe {
left: -1px;
.stream-privacy {
.zulip-icon {
position: relative;
left: -1px;
top: 1.5px;
}
}
}

Expand Down
21 changes: 10 additions & 11 deletions web/styles/subscriptions.css
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -828,18 +826,19 @@ 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;
font-size: 1.09em;
font-weight: 800;
}

.zulip-icon-globe {
font-size: 15px;
.zulip-icon {
font-size: 18px;
position: relative;
top: 1px;
}
}

Expand Down
39 changes: 27 additions & 12 deletions web/styles/zulip.css
Expand Up @@ -1159,6 +1159,15 @@ td.pointer {
}
}

.stream-privacy i {
font-size: 15px;

&.zulip-icon-globe,
&.zulip-icon-hashtag {
position: relative;
top: -0.5px;
}
}
}
}

Expand Down Expand Up @@ -1232,7 +1241,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 {
Expand Down Expand Up @@ -1789,12 +1810,6 @@ div.focused_table {
display: none;
}

.zulip-icon.zulip-icon-globe {
font-size: 14px;
position: relative;
top: 1px;
}

.sub_count,
.stream,
& > span {
Expand All @@ -1820,11 +1835,6 @@ div.focused_table {
}

.fa {
&.fa-lock {
position: relative;
top: 0.5px;
}

.fa-envelope {
font-size: 14px;
margin: 0 5px;
Expand All @@ -1844,6 +1854,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 {
Expand Down Expand Up @@ -2398,7 +2414,6 @@ select.invite-as {
}

.date_row {
padding-left: 2px;
text-align: right;
}

Expand Down
4 changes: 2 additions & 2 deletions 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}}
Expand Down
4 changes: 2 additions & 2 deletions 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}}
8 changes: 5 additions & 3 deletions 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}}
4 changes: 2 additions & 2 deletions 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>

0 comments on commit c4e16e7

Please sign in to comment.