mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	python: Reformat with Black, except quotes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							5028c081cb
						
					
				
				
					commit
					11741543da
				
			@@ -15,6 +15,7 @@ def gravatar_hash(email: str) -> str:
 | 
			
		||||
    # not error out on it.
 | 
			
		||||
    return make_safe_digest(email.lower(), hashlib.md5)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def user_avatar_hash(uid: str) -> str:
 | 
			
		||||
 | 
			
		||||
    # WARNING: If this method is changed, you may need to do a migration
 | 
			
		||||
@@ -26,15 +27,18 @@ def user_avatar_hash(uid: str) -> str:
 | 
			
		||||
    user_key = uid + settings.AVATAR_SALT
 | 
			
		||||
    return make_safe_digest(user_key, hashlib.sha1)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def user_avatar_path(user_profile: UserProfile) -> str:
 | 
			
		||||
 | 
			
		||||
    # WARNING: If this method is changed, you may need to do a migration
 | 
			
		||||
    # similar to zerver/migrations/0060_move_avatars_to_be_uid_based.py .
 | 
			
		||||
    return user_avatar_path_from_ids(user_profile.id, user_profile.realm_id)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def user_avatar_path_from_ids(user_profile_id: int, realm_id: int) -> str:
 | 
			
		||||
    user_id_hash = user_avatar_hash(str(user_profile_id))
 | 
			
		||||
    return f'{str(realm_id)}/{user_id_hash}'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def user_avatar_content_hash(ldap_avatar: bytes) -> str:
 | 
			
		||||
    return hashlib.sha256(ldap_avatar).hexdigest()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user