Skip to content
Snippets Groups Projects
Commit 74f6b50a authored by Stan Hu's avatar Stan Hu
Browse files

Update discussions after note is saved

This still updates both notes in the same transaction.
parent 5a160b7f
Branches sh-fix-discussion-note-promotion-failure-handling
No related tags found
No related merge requests found
Loading
Loading
@@ -29,8 +29,9 @@ def execute
note_saved = note.with_transaction_returning_status do
break false if only_commands
 
before_save(note)
note.save
note.save.tap do
update_discussions(note)
end
end
 
when_saved(note) if note_saved
Loading
Loading
@@ -57,7 +58,7 @@ def quick_actions_service
@quick_actions_service ||= QuickActionsService.new(project, current_user)
end
 
def before_save(note)
def update_discussions(note)
# Ensure that individual notes that are promoted into discussions are
# updated in a transaction with the note creation to avoid inconsistencies:
# https://gitlab.com/gitlab-org/gitlab/-/issues/301237
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment