mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	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:
		@@ -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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user