From eba2d470dc516374a86c55825b73435a1d376579 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 22 Jul 2016 14:45:24 -0700 Subject: [PATCH] Fix removing attachments when editing a message. Fixes #1373. --- zerver/lib/actions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 7e7caa381e..aa5e7aa1b1 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -2386,7 +2386,8 @@ def update_user_message_flags(message, ums): for um in changed_ums: um.save(update_fields=['flags']) - +# We use transaction.atomic to support select_for_update in the attachment codepath. +@transaction.atomic def do_update_message(user_profile, message, subject, propagate_mode, content, rendered_content): # type: (UserProfile, Message, Optional[text_type], str, Optional[text_type], Optional[text_type]) -> None event = {'type': 'update_message',