diff options
Diffstat (limited to 'app/services/git/branch_hooks_service.rb')
-rw-r--r-- | app/services/git/branch_hooks_service.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/services/git/branch_hooks_service.rb b/app/services/git/branch_hooks_service.rb index 92e7702727c..dcb32b4c84b 100644 --- a/app/services/git/branch_hooks_service.rb +++ b/app/services/git/branch_hooks_service.rb @@ -75,6 +75,7 @@ module Git def branch_change_hooks enqueue_process_commit_messages + enqueue_jira_connect_sync_messages end def branch_remove_hooks @@ -103,6 +104,17 @@ module Git end end + def enqueue_jira_connect_sync_messages + return unless project.jira_subscription_exists? + + branch_to_sync = branch_name if Atlassian::JiraIssueKeyExtractor.has_keys?(branch_name) + commits_to_sync = limited_commits.select { |commit| Atlassian::JiraIssueKeyExtractor.has_keys?(commit.safe_message) }.map(&:sha) + + if branch_to_sync || commits_to_sync.any? + JiraConnect::SyncBranchWorker.perform_async(project.id, branch_to_sync, commits_to_sync) + end + end + def unsigned_x509_shas(commits) X509CommitSignature.unsigned_commit_shas(commits.map(&:sha)) end |