mirror of https://github.com/zulip/zulip.git
stream_popover: Link to channel settings' "Personal" tab conditionally.
This commit adds a link to the "Personal" tab of the channel settings modal from the "Channel settings" link in the channel actions popover when the user doesn't have the permission to change the channel permissions. Fixes #30529.
This commit is contained in:
parent
15e26b9f32
commit
6b5618b9d8
|
@ -21,6 +21,7 @@ import * as popover_menus from "./popover_menus";
|
||||||
import {left_sidebar_tippy_options} from "./popover_menus";
|
import {left_sidebar_tippy_options} from "./popover_menus";
|
||||||
import {web_channel_default_view_values} from "./settings_config";
|
import {web_channel_default_view_values} from "./settings_config";
|
||||||
import * as settings_data from "./settings_data";
|
import * as settings_data from "./settings_data";
|
||||||
|
import {current_user} from "./state_data";
|
||||||
import * as stream_color from "./stream_color";
|
import * as stream_color from "./stream_color";
|
||||||
import * as stream_data from "./stream_data";
|
import * as stream_data from "./stream_data";
|
||||||
import * as stream_settings_api from "./stream_settings_api";
|
import * as stream_settings_api from "./stream_settings_api";
|
||||||
|
@ -150,7 +151,14 @@ function build_stream_popover(opts) {
|
||||||
const sub = stream_popover_sub(e);
|
const sub = stream_popover_sub(e);
|
||||||
hide_stream_popover();
|
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);
|
browser_history.go_to_location(stream_edit_hash);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue