diff options
author | Robert Speicher <robert@gitlab.com> | 2017-12-22 17:18:22 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2017-12-22 17:18:22 +0000 |
commit | 87dbf9846dcc870581ed753c730d768e671c51d4 (patch) | |
tree | c5fbc5bea4912bb1587720c55462702e9e786a58 /app | |
parent | 77d190b4b4ebd78daa965eb4a2ed4a1e3579d956 (diff) | |
parent | 16b8297e77501134cd93a74c3d5c60712930e7fd (diff) | |
download | gitlab-ce-87dbf9846dcc870581ed753c730d768e671c51d4.tar.gz |
Merge branch 'dm-issue-move-transaction-error' into 'master'
Execute project hooks and services after commit when moving an issue
Closes #41324
See merge request gitlab-org/gitlab-ce!16108
Diffstat (limited to 'app')
-rw-r--r-- | app/models/project.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 3440c01b356..f9c640300ff 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -951,7 +951,9 @@ class Project < ActiveRecord::Base def send_move_instructions(old_path_with_namespace) # New project path needs to be committed to the DB or notification will # retrieve stale information - run_after_commit { NotificationService.new.project_was_moved(self, old_path_with_namespace) } + run_after_commit do + NotificationService.new.project_was_moved(self, old_path_with_namespace) + end end def owner @@ -963,15 +965,19 @@ class Project < ActiveRecord::Base end def execute_hooks(data, hooks_scope = :push_hooks) - hooks.public_send(hooks_scope).each do |hook| # rubocop:disable GitlabSecurity/PublicSend - hook.async_execute(data, hooks_scope.to_s) + run_after_commit_or_now do + hooks.public_send(hooks_scope).each do |hook| # rubocop:disable GitlabSecurity/PublicSend + hook.async_execute(data, hooks_scope.to_s) + end end end def execute_services(data, hooks_scope = :push_hooks) # Call only service hooks that are active for this scope - services.public_send(hooks_scope).each do |service| # rubocop:disable GitlabSecurity/PublicSend - service.async_execute(data) + run_after_commit_or_now do + services.public_send(hooks_scope).each do |service| # rubocop:disable GitlabSecurity/PublicSend + service.async_execute(data) + end end end |