mirror of https://github.com/zulip/zulip.git
uploads: Make realm_avatar_and_logo_path non-abstract.
This commit is contained in:
parent
8e68d68f32
commit
43fe24a5a0
|
@ -1,4 +1,5 @@
|
|||
import io
|
||||
import os
|
||||
import re
|
||||
import unicodedata
|
||||
from typing import IO, Any, Callable, Optional, Tuple
|
||||
|
@ -257,7 +258,7 @@ class ZulipUploadBackend:
|
|||
raise NotImplementedError()
|
||||
|
||||
def realm_avatar_and_logo_path(self, realm: Realm) -> str:
|
||||
raise NotImplementedError()
|
||||
return os.path.join(str(realm.id), "realm")
|
||||
|
||||
|
||||
def create_attachment(
|
||||
|
|
|
@ -175,9 +175,6 @@ class LocalUploadBackend(ZulipUploadBackend):
|
|||
image_data = read_local_file("avatars", source_file_path + ".original")
|
||||
self.write_avatar_images(target_file_path, image_data)
|
||||
|
||||
def realm_avatar_and_logo_path(self, realm: Realm) -> str:
|
||||
return os.path.join(str(realm.id), "realm")
|
||||
|
||||
def upload_realm_icon_image(self, icon_file: IO[bytes], user_profile: UserProfile) -> None:
|
||||
upload_path = self.realm_avatar_and_logo_path(user_profile.realm)
|
||||
image_data = icon_file.read()
|
||||
|
|
|
@ -312,9 +312,6 @@ class S3UploadBackend(ZulipUploadBackend):
|
|||
# export_path has a leading /
|
||||
return self.get_public_upload_url(export_path[1:])
|
||||
|
||||
def realm_avatar_and_logo_path(self, realm: Realm) -> str:
|
||||
return os.path.join(str(realm.id), "realm")
|
||||
|
||||
def upload_realm_icon_image(self, icon_file: IO[bytes], user_profile: UserProfile) -> None:
|
||||
content_type = guess_type(icon_file.name)[0]
|
||||
s3_file_name = os.path.join(self.realm_avatar_and_logo_path(user_profile.realm), "icon")
|
||||
|
|
Loading…
Reference in New Issue