Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

upload: Reorder arguments to parallel upload_message_attachment.

Alex Vandiverf97a30f24014
diff --git a/zerver/lib/upload/__init__.py b/zerver/lib/upload/__init__.py
index f22cc5240a9..a7c701c0c7f 100644
--- a/zerver/lib/upload/__init__.py
+++ b/zerver/lib/upload/__init__.py
@@ -43,10 +43,10 @@ def check_upload_within_quota(realm: Realm, uploaded_file_size: int) -> None:
def create_attachment(
file_name: str,
path_id: str,
+ content_type: str,
+ file_size: int,
user_profile: UserProfile,
realm: Realm,
- file_size: int,
- content_type: str,
) -> None:
assert (user_profile.realm_id == realm.id) or is_cross_realm_bot_email(
user_profile.delivery_email
@@ -143,10 +143,10 @@ def upload_message_attachment(
create_attachment(
uploaded_file_name,
path_id,
+ content_type,
+ len(file_data),
user_profile,
target_realm,
- len(file_data),
- content_type,
)
return f"/user_uploads/{path_id}"
diff --git a/zerver/tests/test_message_fetch.py b/zerver/tests/test_message_fetch.py
index fe3b7723446..f29492cee18 100644
--- a/zerver/tests/test_message_fetch.py
+++ b/zerver/tests/test_message_fetch.py
@@ -4527,7 +4527,7 @@ class MessageHasKeywordsTest(ZulipTestCase):
for file_name, path_id, size in dummy_files:
create_attachment(
- file_name, path_id, user_profile, user_profile.realm, size, "text/plain"
+ file_name, path_id, "text/plain", size, user_profile, user_profile.realm
)
# return path ids
diff --git a/zerver/tests/test_retention.py b/zerver/tests/test_retention.py
index 36e0196f458..b2b535b7f9d 100644
--- a/zerver/tests/test_retention.py
+++ b/zerver/tests/test_retention.py
@@ -191,7 +191,7 @@ class ArchiveMessagesTestingBase(RetentionTestingBase):
for file_name, path_id, size in dummy_files:
create_attachment(
- file_name, path_id, user_profile, user_profile.realm, size, "text/plain"
+ file_name, path_id, "text/plain", size, user_profile, user_profile.realm
)
self.subscribe(user_profile, "Denmark")
@@ -606,7 +606,7 @@ class MoveMessageToArchiveBase(RetentionTestingBase):
user_profile = self.example_user("hamlet")
for file_name, path_id, size in dummy_files:
create_attachment(
- file_name, path_id, user_profile, user_profile.realm, size, "text/plain"
+ file_name, path_id, "text/plain", size, user_profile, user_profile.realm
)
def _assert_archive_empty(self) -> None: