mirror of https://github.com/zulip/zulip.git
groups: Handle "#groups/new" url for users who cannot create groups.
We already do not show the buttons for opening the group creation form if user is not allowed to create group at all, but the user can still open the form by going on "#groups/new" url. This commit fixes this by redirecting such users to "#groups/your" like we do for streams.
This commit is contained in:
parent
2fe36cc0d7
commit
b154cb39f8
|
@ -244,6 +244,11 @@ export function validate_group_settings_hash(hash: string): string {
|
|||
const hash_components = hash.slice(1).split(/\//);
|
||||
const section = hash_components[1];
|
||||
|
||||
const can_create_groups = settings_data.user_can_edit_user_groups();
|
||||
if (section === "new" && !can_create_groups) {
|
||||
return "#groups/your";
|
||||
}
|
||||
|
||||
if (/\d+/.test(section)) {
|
||||
const group_id = Number.parseInt(section, 10);
|
||||
const group = user_groups.maybe_get_user_group_from_id(group_id);
|
||||
|
|
Loading…
Reference in New Issue