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: Improve "not subscribed" banner.

Aadithya-Jd2e2d6a79939
diff --git a/web/e2e-tests/message-basics.test.ts b/web/e2e-tests/message-basics.test.ts
index 60fff5067b2..9da7e6b900a 100644
--- a/web/e2e-tests/message-basics.test.ts
+++ b/web/e2e-tests/message-basics.test.ts
@@ -472,7 +472,7 @@ async function test_narrow_public_streams(page: Page): Promise<void> {
);
assert.ok(
(await page.$(
- `.message-list[data-message-list-id='${message_list_id}'] .stream-status`,
+ `.message-list[data-message-list-id='${message_list_id}'] .stream-status, .message-list[data-message-list-id='${message_list_id}'] .not-subscribed-banner`,
)) !== null,
);
diff --git a/web/src/click_handlers.ts b/web/src/click_handlers.ts
index fc73743e3aa..33d3e216798 100644
--- a/web/src/click_handlers.ts
+++ b/web/src/click_handlers.ts
@@ -303,6 +303,22 @@ export function initialize(): void {
window.location.href = this.href;
});
+ $("body").on("click", ".not-subscribed-banner .load-newer-messages-button", (e) => {
+ e.preventDefault();
+ e.stopPropagation();
+ const filter = narrow_state.filter();
+ if (filter === undefined) {
+ return;
+ }
+
+ message_view.show(filter.terms(), {
+ then_select_id: message_lists.current?.selected_id(),
+ then_select_offset: browser_history.current_scroll_offset(),
+ force_rerender: true,
+ trigger: "bookend load updates",
+ });
+ });
+
$("body").on("click", "#scroll-to-bottom-button-clickable-area", (e) => {
e.preventDefault();
e.stopPropagation();
diff --git a/web/src/message_list.ts b/web/src/message_list.ts
index 2435fd57eb3..389e781f525 100644
--- a/web/src/message_list.ts
+++ b/web/src/message_list.ts
@@ -481,6 +481,8 @@ export class MessageList {
just_unsubscribed = true;
}
+ const can_subscribe = sub && stream_data.can_toggle_subscription(sub);
+
this.view.render_trailing_bookend(
stream_id,
sub?.name,
@@ -490,6 +492,7 @@ export class MessageList {
page_params.is_spectator,
invite_only ?? false,
is_web_public ?? false,
+ can_subscribe,
);
}
diff --git a/web/src/message_list_view.ts b/web/src/message_list_view.ts
index 23f504bca4c..83452f3370c 100644
--- a/web/src/message_list_view.ts
+++ b/web/src/message_list_view.ts
@@ -1933,6 +1933,7 @@ export class MessageListView {
is_spectator: boolean,
invite_only: boolean,
is_web_public: boolean,
+ can_subscribe: boolean | undefined,
): void {
// This is not the only place we render bookends; see also the
// partial in message_group.hbs, which do not set is_trailing_bookend.
@@ -1947,6 +1948,7 @@ export class MessageListView {
is_trailing_bookend: true,
invite_only,
is_web_public,
+ can_subscribe,
}),
);
this.$list.append($rendered_trailing_bookend);
diff --git a/web/styles/message_row.css b/web/styles/message_row.css
index ad9a0d6626a..686c9280b51 100644
--- a/web/styles/message_row.css
+++ b/web/styles/message_row.css
@@ -1249,6 +1249,10 @@
padding-bottom: 10px;
text-align: center;
+ .zulip-icon {
+ margin-left: 0.1667em; /* 2px at 12px / em */
+ }
+
.stream-status {
opacity: 0.6;
@@ -1332,3 +1336,24 @@
}
}
}
+
+.not-subscribed-banner {
+ .banner-content {
+ align-items: center;
+ }
+
+ .zulip-icon.zulip-icon-globe {
+ font-size: 0.8571em; /* 12px at 14px/1em */
+ vertical-align: -0.0714em; /* -1px at 14px/1em */
+ }
+
+ .zulip-icon.zulip-icon-lock {
+ font-size: 0.9286em; /* 13px at 14px/1em */
+ vertical-align: -0.0714em; /* -1px at 14px/1em */
+ }
+
+ .zulip-icon.zulip-icon-hashtag {
+ font-size: 0.9286em; /* 13px at 14px/1em */
+ vertical-align: -0.1429em; /* -2px at 14px/1em */
+ }
+}
diff --git a/web/templates/bookend.hbs b/web/templates/bookend.hbs
index 89ce9eb42ef..dbe928ba5c8 100644
--- a/web/templates/bookend.hbs
+++ b/web/templates/bookend.hbs
@@ -5,28 +5,70 @@
<a href="#recent">{{t "Browse recent conversations" }}</a>
</span>
{{else}}
- <span class="stream-status bookend-label">
- {{#if deactivated}}
+ {{#if deactivated}}
+ <span class="stream-status bookend-label">
{{t "This channel has been archived." }}
- {{else if subscribed }}
+ </span>
+ {{else if subscribed }}
+ <span class="stream-status bookend-label">
{{#tr}}
You subscribed to <z-stream-name></z-stream-name>. <channel-settings-link></channel-settings-link>
{{#*inline "z-stream-name"}}{{> stream_privacy . }} {{stream_name}}{{/inline}}
{{#*inline "channel-settings-link"}} <a class="bookend-channel-settings-link" href="#channels/{{stream_id}}/{{stream_name}}/personal">{{t 'Manage channel settings'}}</a>{{/inline}}
{{/tr}}
- {{else if just_unsubscribed }}
- {{#tr}}
- You unsubscribed from <z-stream-name></z-stream-name>. <channel-settings-link></channel-settings-link>
- {{#*inline "z-stream-name"}}{{> stream_privacy . }} {{stream_name}}{{/inline}}
- {{#*inline "channel-settings-link"}} <a class="bookend-channel-settings-link" href="#channels/{{stream_id}}/{{stream_name}}/general">{{t 'View in channel settings'}}</a>{{/inline}}
- {{/tr}}
+ </span>
+ {{else if just_unsubscribed }}
+ {{#if is_trailing_bookend}}
+ <div class="not-subscribed-banner banner banner-info">
+ <span class="banner-content">
+ <span class="banner-label">
+ {{#tr}}
+ Because you aren't subscribed to <z-stream-name></z-stream-name>, you won't see new messages, reactions, and other updates.
+ {{#*inline "z-stream-name"}}{{> stream_privacy . }} {{stream_name}}{{/inline}}
+ {{/tr}}
+ </span>
+ <span class="banner-action-buttons">
+ <button class="load-newer-messages-button action-button action-button-borderless-info" type="button">
+ <span class="action-button-label">{{t 'Load updates'}}</span>
+ </button>
+ {{#if can_subscribe}}
+ <button class="stream_sub_unsub_button action-button action-button-quiet-info" type="button">
+ <span class="action-button-label">{{t 'Subscribe'}}</span>
+ </button>
+ {{/if}}
+ </span>
+ </span>
+ </div>
{{else}}
- {{#tr}}
- You are not subscribed to <z-stream-name></z-stream-name>. <subscribe-button></subscribe-button>
- {{#*inline "z-stream-name"}}{{> stream_privacy . }} {{stream_name}}{{/inline}}
- {{#*inline "subscribe-button"}} <a class="stream_sub_unsub_button">{{t 'Subscribe'}}</a>{{/inline}}
- {{/tr}}
+ <span class="stream-status bookend-label">
+ {{#tr}}
+ You unsubscribed from <z-stream-name></z-stream-name>. <channel-settings-link></channel-settings-link>
+ {{#*inline "z-stream-name"}}{{> stream_privacy . }} {{stream_name}}{{/inline}}
+ {{#*inline "channel-settings-link"}} <a class="bookend-channel-settings-link" href="#channels/{{stream_id}}/{{stream_name}}/general">{{t 'View in channel settings'}}</a>{{/inline}}
+ {{/tr}}
+ </span>
{{/if}}
- </span>
+ {{else}}
+ <div class="not-subscribed-banner banner banner-info">
+ <span class="banner-content">
+ <span class="banner-label">
+ {{#tr}}
+ Because you aren't subscribed to <z-stream-name></z-stream-name>, you won't see new messages, reactions, and other updates.
+ {{#*inline "z-stream-name"}}{{> stream_privacy . }} {{stream_name}}{{/inline}}
+ {{/tr}}
+ </span>
+ <span class="banner-action-buttons">
+ <button class="load-newer-messages-button action-button action-button-borderless-info" type="button">
+ <span class="action-button-label">{{t 'Load updates'}}</span>
+ </button>
+ {{#if can_subscribe}}
+ <button class="stream_sub_unsub_button action-button action-button-quiet-info" type="button">
+ <span class="action-button-label">{{t 'Subscribe'}}</span>
+ </button>
+ {{/if}}
+ </span>
+ </span>
+ </div>
+ {{/if}}
{{/if}}
</div>