slack: Call the correct resize_* function when importing realm icon.

For resizing the icon.png files, we use resize_avatar, not resize_logo.
This is pretty confusing - sure, for icons we use the same function as
for avatars, but we should have a proper name for the function called in
the icon context. So this commit also adds resize_realm_icon, and
changes the calls to resize_avatar in icon contexts to
resize_realm_icon.
This commit is contained in:
Mateusz Mandera
2024-11-08 23:21:02 +01:00
committed by Tim Abbott
parent cb6c60ef7a
commit 420849ff6a
4 changed files with 10 additions and 6 deletions

View File

@@ -179,6 +179,10 @@ def resize_avatar(image_data: bytes, size: int = DEFAULT_AVATAR_SIZE) -> bytes:
).write_to_buffer(".png")
def resize_realm_icon(image_data: bytes) -> bytes:
return resize_avatar(image_data)
def resize_logo(image_data: bytes) -> bytes:
# This will only scale the image down, and will resize it to
# preserve aspect ratio and be contained within 8*AVATAR by AVATAR