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_popover: Link to channel settings' "Personal" tab conditionally.

Sayam Samal6b5618b9d82d
diff --git a/web/src/stream_popover.js b/web/src/stream_popover.js
index 8588e252020..c9b2130e175 100644
--- a/web/src/stream_popover.js
+++ b/web/src/stream_popover.js
@@ -21,6 +21,7 @@ import * as popover_menus from "./popover_menus";
import {left_sidebar_tippy_options} from "./popover_menus";
import {web_channel_default_view_values} from "./settings_config";
import * as settings_data from "./settings_data";
+import {current_user} from "./state_data";
import * as stream_color from "./stream_color";
import * as stream_data from "./stream_data";
import * as stream_settings_api from "./stream_settings_api";
@@ -150,7 +151,14 @@ function build_stream_popover(opts) {
const sub = stream_popover_sub(e);
hide_stream_popover();
- const stream_edit_hash = hash_util.channels_settings_edit_url(sub, "general");
+ // Admin can change any stream's name & description either stream is public or
+ // private, subscribed or unsubscribed.
+ const can_change_name_description = current_user.is_admin;
+ const can_change_stream_permissions = stream_data.can_change_permissions(sub);
+ let stream_edit_hash = hash_util.channels_settings_edit_url(sub, "general");
+ if (!can_change_stream_permissions && !can_change_name_description) {
+ stream_edit_hash = hash_util.channels_settings_edit_url(sub, "personal");
+ }
browser_history.go_to_location(stream_edit_hash);
});