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.

popover: Add href for Channel settings link.

Raj Vishwakarmaeeb730c9f98f
diff --git a/web/src/stream_popover.ts b/web/src/stream_popover.ts
index 93bfb027296..c6dba0785d5 100644
--- a/web/src/stream_popover.ts
+++ b/web/src/stream_popover.ts
@@ -121,12 +121,24 @@ function build_stream_popover(opts: {elt: HTMLElement; stream_id: number}): void
const stream_unread = unread.unread_count_info_for_stream(stream_id);
const stream_unread_count = stream_unread.unmuted_count + stream_unread.muted_count;
const has_unread_messages = stream_unread_count > 0;
+
+ // Admin can change any stream's name & description either stream is public or
+ // private, subscribed or unsubscribed.
+ const sub = sub_store.get(stream_id);
+ assert(sub !== undefined);
+
+ const can_change_permissions =
+ stream_data.can_change_permissions_requiring_metadata_access(sub);
+ const settings_section = can_change_permissions ? "general" : "personal";
+ const stream_edit_hash = hash_util.channels_settings_edit_url(sub, settings_section);
+
const content = render_left_sidebar_stream_actions_popover({
stream: {
- ...sub_store.get(stream_id),
+ ...sub,
url: browser_history.get_full_url(stream_hash),
list_of_topics_view_url: hash_util.by_channel_topic_list_url(stream_id),
},
+ stream_edit_hash,
has_unread_messages,
show_go_to_channel_feed,
show_go_to_list_of_topics,
@@ -170,22 +182,6 @@ function build_stream_popover(opts: {elt: HTMLElement; stream_id: number}): void
hide_stream_popover(instance);
});
- // Stream settings
- $popper.on("click", ".open_stream_settings", (e) => {
- const sub = stream_popover_sub(e);
- hide_stream_popover(instance);
-
- // Admin can change any stream's name & description either stream is public or
- // private, subscribed or unsubscribed.
- const can_change_stream_permissions =
- stream_data.can_change_permissions_requiring_metadata_access(sub);
- let stream_edit_hash = hash_util.channels_settings_edit_url(sub, "general");
- if (!can_change_stream_permissions) {
- stream_edit_hash = hash_util.channels_settings_edit_url(sub, "personal");
- }
- browser_history.go_to_location(stream_edit_hash);
- });
-
// Pin/unpin
$popper.on("click", ".pin_to_top", (e) => {
const sub = stream_popover_sub(e);
diff --git a/web/templates/popovers/left_sidebar/left_sidebar_stream_actions_popover.hbs b/web/templates/popovers/left_sidebar/left_sidebar_stream_actions_popover.hbs
index 6c421ccb319..f377bdc2b01 100644
--- a/web/templates/popovers/left_sidebar/left_sidebar_stream_actions_popover.hbs
+++ b/web/templates/popovers/left_sidebar/left_sidebar_stream_actions_popover.hbs
@@ -49,7 +49,7 @@
</li>
<li role="separator" class="popover-menu-separator hidden-for-spectators"></li>
<li role="none" class="link-item popover-menu-list-item hidden-for-spectators">
- <a role="menuitem" class="open_stream_settings popover-menu-link" tabindex="0">
+ <a role="menuitem" href="{{stream_edit_hash}}" class="open_stream_settings popover-menu-link" tabindex="0">
<i class="popover-menu-icon zulip-icon zulip-icon-gear" aria-hidden="true"></i>
<span class="popover-menu-label">{{t "Channel settings" }}</span>
</a>