mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	bots: Clean up editing bots impacting non-bot users.
This fixes a bug where the endpoint for editing bot users would allow an organization administrator to edit the full name of a bot user. A combination of this an another recently fixed bug made it possible for this process to set a `bot_owner` for a non-bot user; so we also include a migration to fix that for any users that might have had our model invariants corrupted in that way.
This commit is contained in:
		@@ -172,6 +172,8 @@ def patch_bot_backend(
 | 
			
		||||
    except UserProfile.DoesNotExist:
 | 
			
		||||
        return json_error(_('No such user'))
 | 
			
		||||
 | 
			
		||||
    if not bot.is_bot:
 | 
			
		||||
        return json_error(_('No such bot'))
 | 
			
		||||
    if not user_profile.can_admin_user(bot):
 | 
			
		||||
        return json_error(_('Insufficient permission'))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user