mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
attachment: Remove unused claim_attachment return value.
This commit is contained in:
@@ -3261,10 +3261,9 @@ def do_get_streams(user_profile, include_public=True, include_subscribed=True,
|
|||||||
return streams
|
return streams
|
||||||
|
|
||||||
def do_claim_attachments(message):
|
def do_claim_attachments(message):
|
||||||
# type: (Message) -> List[Tuple[Text, bool]]
|
# type: (Message) -> None
|
||||||
attachment_url_list = attachment_url_re.findall(message.content)
|
attachment_url_list = attachment_url_re.findall(message.content)
|
||||||
|
|
||||||
results = []
|
|
||||||
for url in attachment_url_list:
|
for url in attachment_url_list:
|
||||||
path_id = attachment_url_to_path_id(url)
|
path_id = attachment_url_to_path_id(url)
|
||||||
user_profile = message.sender
|
user_profile = message.sender
|
||||||
@@ -3276,11 +3275,7 @@ def do_claim_attachments(message):
|
|||||||
logging.warning("User %s does not have permission to access upload %s" % (user_profile.id, path_id,))
|
logging.warning("User %s does not have permission to access upload %s" % (user_profile.id, path_id,))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
is_claimed = claim_attachment(user_profile, path_id, message,
|
claim_attachment(user_profile, path_id, message, is_message_realm_public)
|
||||||
is_message_realm_public)
|
|
||||||
results.append((path_id, is_claimed))
|
|
||||||
|
|
||||||
return results
|
|
||||||
|
|
||||||
def do_delete_old_unclaimed_attachments(weeks_ago):
|
def do_delete_old_unclaimed_attachments(weeks_ago):
|
||||||
# type: (int) -> None
|
# type: (int) -> None
|
||||||
|
|||||||
@@ -484,16 +484,11 @@ def upload_message_image(uploaded_file_name, uploaded_file_size,
|
|||||||
content_type, file_data, user_profile, target_realm=target_realm)
|
content_type, file_data, user_profile, target_realm=target_realm)
|
||||||
|
|
||||||
def claim_attachment(user_profile, path_id, message, is_message_realm_public):
|
def claim_attachment(user_profile, path_id, message, is_message_realm_public):
|
||||||
# type: (UserProfile, Text, Message, bool) -> bool
|
# type: (UserProfile, Text, Message, bool) -> None
|
||||||
try:
|
attachment = Attachment.objects.get(path_id=path_id)
|
||||||
attachment = Attachment.objects.get(path_id=path_id)
|
attachment.messages.add(message)
|
||||||
attachment.messages.add(message)
|
attachment.is_realm_public = attachment.is_realm_public or is_message_realm_public
|
||||||
attachment.is_realm_public = attachment.is_realm_public or is_message_realm_public
|
attachment.save()
|
||||||
attachment.save()
|
|
||||||
return True
|
|
||||||
except Attachment.DoesNotExist:
|
|
||||||
raise JsonableError(_("The upload was not successful. Please reupload the file again in a new message."))
|
|
||||||
return False
|
|
||||||
|
|
||||||
def create_attachment(file_name, path_id, user_profile, file_size):
|
def create_attachment(file_name, path_id, user_profile, file_size):
|
||||||
# type: (Text, Text, UserProfile, int) -> bool
|
# type: (Text, Text, UserProfile, int) -> bool
|
||||||
|
|||||||
Reference in New Issue
Block a user