Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
upload: Rename backend to store_realm_icon_image.
Alex Vandiver7457d7a608da
diff --git a/zerver/lib/upload/__init__.py b/zerver/lib/upload/__init__.pyindex 2aaed4f3c0d..c071be29504 100644--- a/zerver/lib/upload/__init__.py+++ b/zerver/lib/upload/__init__.py@@ -476,7 +476,7 @@ def delete_avatar_image(user_profile: UserProfile, avatar_version: int) -> None:def upload_icon_image(user_file: IO[bytes], user_profile: UserProfile, content_type: str) -> None:if content_type not in THUMBNAIL_ACCEPT_IMAGE_TYPES:raise BadImageError(_("Invalid image format"))- upload_backend.upload_realm_icon_image(user_file, user_profile, content_type)+ upload_backend.store_realm_icon_image(user_file, user_profile, content_type)def upload_logo_image(diff --git a/zerver/lib/upload/base.py b/zerver/lib/upload/base.pyindex 89e78039abc..8b6b36a9464 100644--- a/zerver/lib/upload/base.py+++ b/zerver/lib/upload/base.py@@ -113,7 +113,7 @@ class ZulipUploadBackend:def get_realm_icon_url(self, realm_id: int, version: int) -> str:raise NotImplementedError- def upload_realm_icon_image(+ def store_realm_icon_image(self, icon_file: IO[bytes], user_profile: UserProfile, content_type: str) -> None:raise NotImplementedErrordiff --git a/zerver/lib/upload/local.py b/zerver/lib/upload/local.pyindex 4456a182e22..d0552751d5f 100644--- a/zerver/lib/upload/local.py+++ b/zerver/lib/upload/local.py@@ -181,7 +181,7 @@ class LocalUploadBackend(ZulipUploadBackend):return f"/user_avatars/{realm_id}/realm/icon.png?version={version}"@override- def upload_realm_icon_image(+ def store_realm_icon_image(self, icon_file: IO[bytes], user_profile: UserProfile, content_type: str) -> None:upload_path = self.realm_avatar_and_logo_path(user_profile.realm)diff --git a/zerver/lib/upload/s3.py b/zerver/lib/upload/s3.pyindex ab1da2069b6..6c0df6f4df6 100644--- a/zerver/lib/upload/s3.py+++ b/zerver/lib/upload/s3.py@@ -401,7 +401,7 @@ class S3UploadBackend(ZulipUploadBackend):return public_url + f"?version={version}"@override- def upload_realm_icon_image(+ def store_realm_icon_image(self, icon_file: IO[bytes], user_profile: UserProfile, content_type: str) -> None:s3_file_name = os.path.join(self.realm_avatar_and_logo_path(user_profile.realm), "icon")diff --git a/zerver/tests/test_import_export.py b/zerver/tests/test_import_export.pyindex c110dc9e847..20dae626ee6 100644--- a/zerver/tests/test_import_export.py+++ b/zerver/tests/test_import_export.py@@ -210,7 +210,7 @@ class ExportFile(ZulipTestCase):realm = user_profile.realmwith get_test_image_file("img.png") as img_file:- upload.upload_backend.upload_realm_icon_image(img_file, user_profile, "image/png")+ upload.upload_backend.store_realm_icon_image(img_file, user_profile, "image/png")do_change_icon_source(realm, Realm.ICON_UPLOADED, acting_user=None)with get_test_image_file("img.png") as img_file:diff --git a/zerver/tests/test_upload_s3.py b/zerver/tests/test_upload_s3.pyindex edc28f3f363..9f659fa9ff0 100644--- a/zerver/tests/test_upload_s3.py+++ b/zerver/tests/test_upload_s3.py@@ -559,7 +559,7 @@ class S3Test(ZulipTestCase):user_profile = self.example_user("hamlet")with get_test_image_file("img.png") as image_file:- zerver.lib.upload.upload_backend.upload_realm_icon_image(+ zerver.lib.upload.upload_backend.store_realm_icon_image(image_file, user_profile, content_type="image/png")