mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 22:43:42 +00:00
attachments: Return a list of removed attachments while editing.
Currently, we want to ask users if they would like to delete their attachments after they have removed the attachments while editing. These changes are preparatory changes on the backend to return a list of removed attachments after the user has removed attachments while editing. Fixes part of #25525.
This commit is contained in:
@@ -16,6 +16,7 @@ import orjson
|
||||
import responses
|
||||
from django.apps import apps
|
||||
from django.conf import settings
|
||||
from django.core.files.uploadedfile import UploadedFile
|
||||
from django.core.mail import EmailMessage
|
||||
from django.core.signals import got_request_exception
|
||||
from django.db import connection, transaction
|
||||
@@ -76,6 +77,7 @@ from zerver.lib.test_helpers import (
|
||||
)
|
||||
from zerver.lib.thumbnail import ThumbnailFormat
|
||||
from zerver.lib.topic import RESOLVED_TOPIC_PREFIX, filter_by_topic_name_via_message
|
||||
from zerver.lib.upload import upload_message_attachment_from_request
|
||||
from zerver.lib.user_groups import get_system_user_group_for_user
|
||||
from zerver.lib.users import get_api_key
|
||||
from zerver.lib.webhooks.common import (
|
||||
@@ -2027,6 +2029,14 @@ Output:
|
||||
):
|
||||
yield
|
||||
|
||||
def create_attachment_helper(self, user: UserProfile) -> str:
|
||||
with tempfile.NamedTemporaryFile() as attach_file:
|
||||
attach_file.write(b"Hello, World!")
|
||||
attach_file.flush()
|
||||
with open(attach_file.name, "rb") as fp:
|
||||
file_path = upload_message_attachment_from_request(UploadedFile(fp), user)
|
||||
return file_path
|
||||
|
||||
|
||||
class ZulipTestCase(ZulipTestCaseMixin, TestCase):
|
||||
@contextmanager
|
||||
|
||||
Reference in New Issue
Block a user