mirror of
https://github.com/zulip/zulip.git
synced 2025-11-17 04:12:02 +00:00
user_groups: Handle inaccessible streams in group deactivation error.
If the user group being deactivated is used as a setting for a stream which cannot be accessed by the user trying to deactivate the group, we show "Unknown stream" in the banner mentioning where the group is used.
This commit is contained in:
@@ -886,8 +886,17 @@ function parse_args_for_deactivation_banner(objections) {
|
||||
if (objection.type === "channel") {
|
||||
const stream_id = objection.channel_id;
|
||||
const sub = stream_data.get_sub_by_id(stream_id);
|
||||
const setting_url = hash_util.channels_settings_edit_url(sub, "general");
|
||||
args.streams_using_group_for_setting.push({stream_name: sub.name, setting_url});
|
||||
if (sub !== undefined) {
|
||||
args.streams_using_group_for_setting.push({
|
||||
stream_name: sub.name,
|
||||
setting_url: hash_util.channels_settings_edit_url(sub, "general"),
|
||||
});
|
||||
} else {
|
||||
args.streams_using_group_for_setting.push({
|
||||
stream_name: $t({defaultMessage: "Unknown stream"}),
|
||||
setting_url: undefined,
|
||||
});
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
{{t "This group cannot be deactivated because it is used in following places:"}}
|
||||
<ul>
|
||||
{{#each streams_using_group_for_setting}}
|
||||
{{#if this.setting_url}}
|
||||
<li><a href="{{this.setting_url}}">#{{this.stream_name}}</a></li>
|
||||
{{else}}
|
||||
<li>{{this.stream_name}}</li>
|
||||
{{/if}}
|
||||
{{/each}}
|
||||
{{#each groups_using_group_for_setting}}
|
||||
<li><a href="{{this.setting_url}}">@{{this.group_name}}</a></li>
|
||||
|
||||
Reference in New Issue
Block a user