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_settings: Rearrange channel property change alert notification.

PieterCK626272696a10
diff --git a/web/src/resize.ts b/web/src/resize.ts
index 9e602e2a591..1e1f753d1ad 100644
--- a/web/src/resize.ts
+++ b/web/src/resize.ts
@@ -190,6 +190,9 @@ export function resize_stream_subscribers_list(): void {
".subscriber_list_settings_container .send_notification_to_new_subscribers_container",
);
const $subscribers_list_header = $("#stream_settings .subscribers-list-header");
+ const $small_window_alert_notification_container = $(
+ ".subscription_settings .small-window-alert-notification-container",
+ );
const elements_above_subscribers_list = [
$tab_container,
@@ -197,6 +200,7 @@ export function resize_stream_subscribers_list(): void {
$add_subscribers_widget,
$notification_message_container,
$subscribers_list_header,
+ $small_window_alert_notification_container,
];
let total_height_of_elements_above_subscribers_list = 0;
diff --git a/web/src/stream_edit.ts b/web/src/stream_edit.ts
index bb465c69685..d69e9a21bc1 100644
--- a/web/src/stream_edit.ts
+++ b/web/src/stream_edit.ts
@@ -30,6 +30,7 @@ import type {User} from "./people.ts";
import * as people from "./people.ts";
import * as popovers from "./popovers.ts";
import {postprocess_content} from "./postprocess_content.ts";
+import {resize_stream_subscribers_list} from "./resize.ts";
import * as scroll_util from "./scroll_util.ts";
import * as settings_components from "./settings_components.ts";
import * as settings_config from "./settings_config.ts";
@@ -547,6 +548,7 @@ export function archive_stream(stream_id: number, $alert_element: JQuery): void
error(xhr) {
ui_report.error($t_html({defaultMessage: "Failed"}), xhr, $alert_element);
dialog_widget.hide_dialog_spinner();
+ resize_stream_subscribers_list();
},
});
}
@@ -938,6 +940,7 @@ export function initialize(): void {
$(".stream_change_property_info"),
);
dialog_widget.hide_dialog_spinner();
+ resize_stream_subscribers_list();
},
});
}
diff --git a/web/src/stream_settings_components.ts b/web/src/stream_settings_components.ts
index e769222eda8..acd617ca6b5 100644
--- a/web/src/stream_settings_components.ts
+++ b/web/src/stream_settings_components.ts
@@ -199,8 +199,6 @@ export function ajaxSubscribe(
$button_elem: JQuery | undefined,
): void {
// Subscribe yourself to a single stream.
- let true_stream_name;
-
if ($stream_row !== undefined) {
display_subscribe_toggle_spinner($stream_row);
}
@@ -221,15 +219,11 @@ export function ajaxSubscribe(
})
.parse(xhr.responseJSON);
if (Object.keys(res.already_subscribed).length > 0) {
- // Display the canonical stream capitalization.
- true_stream_name = res.already_subscribed[current_user.user_id]![0];
ui_report.success(
- $t_html(
- {defaultMessage: "Already subscribed to {channel}"},
- {channel: true_stream_name},
- ),
+ $t_html({defaultMessage: "Already subscribed"}),
$(".stream_change_property_info"),
);
+ resize.resize_stream_subscribers_list();
}
// The rest of the work is done via the subscribe event we will get
@@ -248,10 +242,11 @@ export function ajaxSubscribe(
buttons.hide_button_loading_indicator($button_elem);
}
ui_report.error(
- $t_html({defaultMessage: "Error adding subscription"}),
+ $t_html({defaultMessage: "Error subscribing"}),
xhr,
$(".stream_change_property_info"),
);
+ resize.resize_stream_subscribers_list();
},
});
}
@@ -290,10 +285,11 @@ function ajaxUnsubscribe(
buttons.hide_button_loading_indicator($button_elem);
}
ui_report.error(
- $t_html({defaultMessage: "Error removing subscription"}),
+ $t_html({defaultMessage: "Error unsubscribing"}),
xhr,
$(".stream_change_property_info"),
);
+ resize.resize_stream_subscribers_list();
},
});
}
diff --git a/web/styles/subscriptions.css b/web/styles/subscriptions.css
index 0e143c74609..3adcd060b70 100644
--- a/web/styles/subscriptions.css
+++ b/web/styles/subscriptions.css
@@ -494,6 +494,23 @@ h4.user_group_setting_subsection_title {
display: flex;
width: 100%;
+ /* This works in tandem with ".small-window-alert-notification-container"
+ in the right pane body. */
+ .large-window-alert-notification-container {
+ display: flex;
+
+ @media (width < $sm_min) {
+ display: none;
+ }
+
+ .stream_change_property_info {
+ margin-right: 1px;
+ font-weight: 400;
+ font-size: var(--base-font-size-px);
+ min-width: max-content;
+ }
+ }
+
.selected-stream,
.selected-group {
overflow: hidden;
@@ -1244,11 +1261,6 @@ h4.user_group_setting_subsection_title {
font-size: 1.2857em; /* 18px at 14px/em */
}
}
-
- .stream_change_property_info {
- vertical-align: top;
- margin: 0 5px 0 0;
- }
}
.group-description-wrapper,
@@ -1300,6 +1312,21 @@ h4.user_group_setting_subsection_title {
&.show {
display: block;
}
+
+ /* This works in tandem with ".large-window-alert-notification-container"
+ in the right pane title. */
+ .small-window-alert-notification-container {
+ display: none;
+
+ @media (width < $sm_min) {
+ display: flex;
+ justify-content: end;
+ }
+
+ .stream_change_property_info {
+ margin-bottom: 10px;
+ }
+ }
}
#personal-stream-settings {
@@ -1554,21 +1581,6 @@ h4.user_group_setting_subsection_title {
margin-top: -5px;
}
}
-
- .stream_change_property_info {
- /* For small widths where there is not enough space
- to show alert beside stream name we set its display
- to block so it is shown in new line. But to avoid
- it covering whole screen width we set max-width
- so that it does not losses inline-block appearance. */
-
- /* TODO: This will probably be not required once
- we have tabbed navigation as button group width
- will be smaller. */
- display: block;
- max-width: max-content;
- white-space: nowrap;
- }
}
}
diff --git a/web/templates/stream_settings/selected_stream_title.hbs b/web/templates/stream_settings/selected_stream_title.hbs
index 1ab588b47df..5849ee8231c 100644
--- a/web/templates/stream_settings/selected_stream_title.hbs
+++ b/web/templates/stream_settings/selected_stream_title.hbs
@@ -22,6 +22,9 @@
<div class="left-end button-group">
</div>
<div class="right-end button-group">
+ <div class="large-window-alert-notification-container">
+ <div class="stream_change_property_info alert-notification"></div>
+ </div>
<div class="sub_unsub_button_wrapper inline-block {{#unless should_display_subscription_button }}cannot-subscribe-tooltip{{/unless}}" data-tooltip-template-id="cannot-subscribe-tooltip-template">
<template id="cannot-subscribe-tooltip-template">
<span>
diff --git a/web/templates/stream_settings/stream_settings.hbs b/web/templates/stream_settings/stream_settings.hbs
index 0130ede2698..4ab38a30263 100644
--- a/web/templates/stream_settings/stream_settings.hbs
+++ b/web/templates/stream_settings/stream_settings.hbs
@@ -3,6 +3,9 @@
</div>
<div class="subscription_settings" data-stream-id="{{sub.stream_id}}">
<div class="inner-box">
+ <div class="small-window-alert-notification-container">
+ <div class="stream_change_property_info alert-notification"></div>
+ </div>
<div class="stream-creation-confirmation-banner"></div>
<div class="stream_section" data-stream-section="general">
{{#with sub}}
@@ -17,7 +20,6 @@
<div class="stream-name">
<span class="sub-stream-name" data-tippy-content="{{name}}">{{name}}</span>
</div>
- <div class="stream_change_property_info alert-notification"></div>
<div class="button-group" {{#unless can_change_name_description}}style="display:none"{{/unless}}>
{{> ../components/icon_button
icon="edit"