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: Improve UI for editing stream permissions.

m-e-l-u-h-a-na41d5e58f9b9
diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js
index 8c297f17827..c510eb5719d 100644
--- a/static/js/stream_edit.js
+++ b/static/js/stream_edit.js
@@ -642,11 +642,11 @@ function get_message_retention_days_from_sub(sub) {
function change_stream_privacy(e) {
e.stopPropagation();
+ const data = {};
const stream_id = $(e.target).data("stream-id");
+ const url = "/json/streams/" + stream_id;
+ const status_element = $(".stream_permission_change_info");
const sub = sub_store.get(stream_id);
- const data = {};
- const stream_privacy_status = $(".stream-privacy-status");
- stream_privacy_status.hide();
const privacy_setting = $("#stream_privacy_modal input[name=privacy]:checked").val();
const stream_post_policy = Number.parseInt(
@@ -696,25 +696,13 @@ function change_stream_privacy(e) {
data.message_retention_days = JSON.stringify(message_retention_days);
}
- $(".stream_change_property_info").hide();
+ overlays.close_modal("#stream_privacy_modal");
if (Object.keys(data).length === 0) {
- overlays.close_modal("#stream_privacy_modal");
return;
}
- channel.patch({
- url: "/json/streams/" + stream_id,
- data,
- success() {
- overlays.close_modal("#stream_privacy_modal");
- // The rest will be done by update stream event we will get.
- },
- error(xhr) {
- ui_report.error($t_html({defaultMessage: "Failed"}), xhr, stream_privacy_status);
- $("#change-stream-privacy-button").text($t({defaultMessage: "Try again"}));
- },
- });
+ settings_ui.do_settings_change(channel.patch, url, data, status_element);
}
export function archive_stream(stream_id, alert_element, stream_row) {
diff --git a/static/styles/subscriptions.css b/static/styles/subscriptions.css
index 1b1684de9cb..373a62f38a3 100644
--- a/static/styles/subscriptions.css
+++ b/static/styles/subscriptions.css
@@ -844,8 +844,7 @@
}
}
- .stream-header,
- .stream_setting_subsection_header {
+ .stream-header {
white-space: nowrap;
.stream-name {
@@ -911,6 +910,20 @@
}
}
+ .stream_setting_subsection_header {
+ display: flex;
+
+ .stream_permission_change_info {
+ margin: 12px auto 0 3px;
+ }
+
+ .button-group {
+ display: inline;
+ margin-left: auto;
+ align-self: center;
+ }
+ }
+
.checkmark {
display: none;
margin-left: 5px;
@@ -1056,6 +1069,12 @@
}
}
+#stream_privacy_modal .modal-body {
+ .grey-box {
+ margin-bottom: 20px;
+ }
+}
+
@media (width < $lg_min) {
.subscriptions-container {
max-width: 95%;
@@ -1192,6 +1211,14 @@
}
}
}
+
+ #subscription_overlay .stream_setting_subsection_header {
+ display: block;
+
+ .stream_permission_change_info {
+ margin: 12px auto 0 3px;
+ }
+ }
}
#stream-creation #invites-warning-modal .modal-footer {
diff --git a/static/templates/subscription_settings.hbs b/static/templates/subscription_settings.hbs
index 0f1a16310d3..66d08018271 100644
--- a/static/templates/subscription_settings.hbs
+++ b/static/templates/subscription_settings.hbs
@@ -42,6 +42,7 @@
{{t "Stream permissions" }}
</h3>
{{#if can_change_stream_permissions}}
+ <div class="stream_permission_change_info alert-notification"></div>
<div class="button-group">
<a class="change-stream-privacy button rounded small btn-warning" role="button">
<i class="fa fa-pencil" aria-hidden="true"></i>