upload: Reorder functions into logical groupings.

This commit is contained in:
Alex Vandiver
2023-02-28 03:33:25 +00:00
committed by Tim Abbott
parent 880a3f95a7
commit b31a6dc56c
6 changed files with 312 additions and 293 deletions

View File

@@ -185,6 +185,7 @@ def resize_emoji(
class ZulipUploadBackend:
# Message attachment uploads
def get_public_upload_root_url(self) -> str:
raise NotImplementedError
@@ -202,6 +203,13 @@ class ZulipUploadBackend:
) -> str:
raise NotImplementedError
def delete_message_attachment(self, path_id: str) -> bool:
raise NotImplementedError
# Avatar image uploads
def get_avatar_url(self, hash_key: str, medium: bool = False) -> str:
raise NotImplementedError
def upload_avatar_image(
self,
user_file: IO[bytes],
@@ -211,25 +219,26 @@ class ZulipUploadBackend:
) -> None:
raise NotImplementedError
def delete_avatar_image(self, user: UserProfile) -> None:
raise NotImplementedError
def delete_message_attachment(self, path_id: str) -> bool:
raise NotImplementedError
def get_avatar_url(self, hash_key: str, medium: bool = False) -> str:
raise NotImplementedError
def copy_avatar(self, source_profile: UserProfile, target_profile: UserProfile) -> None:
raise NotImplementedError
def ensure_avatar_image(self, user_profile: UserProfile, is_medium: bool = False) -> None:
raise NotImplementedError
def delete_avatar_image(self, user: UserProfile) -> None:
raise NotImplementedError
# Realm icon and logo uploads
def realm_avatar_and_logo_path(self, realm: Realm) -> str:
return os.path.join(str(realm.id), "realm")
def get_realm_icon_url(self, realm_id: int, version: int) -> str:
raise NotImplementedError
def upload_realm_icon_image(self, icon_file: IO[bytes], user_profile: UserProfile) -> None:
raise NotImplementedError
def get_realm_icon_url(self, realm_id: int, version: int) -> str:
def get_realm_logo_url(self, realm_id: int, version: int, night: bool) -> str:
raise NotImplementedError
def upload_realm_logo_image(
@@ -237,7 +246,8 @@ class ZulipUploadBackend:
) -> None:
raise NotImplementedError
def get_realm_logo_url(self, realm_id: int, version: int, night: bool) -> str:
# Realm emoji uploads
def get_emoji_url(self, emoji_file_name: str, realm_id: int, still: bool = False) -> str:
raise NotImplementedError
def upload_emoji_image(
@@ -245,7 +255,8 @@ class ZulipUploadBackend:
) -> bool:
raise NotImplementedError
def get_emoji_url(self, emoji_file_name: str, realm_id: int, still: bool = False) -> str:
# Export tarballs
def get_export_tarball_url(self, realm: Realm, export_path: str) -> str:
raise NotImplementedError
def upload_export_tarball(
@@ -259,12 +270,6 @@ class ZulipUploadBackend:
def delete_export_tarball(self, export_path: str) -> Optional[str]:
raise NotImplementedError
def get_export_tarball_url(self, realm: Realm, export_path: str) -> str:
raise NotImplementedError
def realm_avatar_and_logo_path(self, realm: Realm) -> str:
return os.path.join(str(realm.id), "realm")
def create_attachment(
file_name: str, path_id: str, user_profile: UserProfile, realm: Realm, file_size: int