fixed 项目可能不存在

This commit is contained in:
xxq250 2025-03-24 13:53:14 +08:00
parent b67ed4d74b
commit 656fb9a2a6
1 changed files with 8 additions and 2 deletions

View File

@ -8,7 +8,8 @@ class TouchWebhookJob < ApplicationJob
issue = Issue.find_by_id issue_id
sender = User.find_by_id sender_id
return if issue.nil? || sender.nil?
issue.project.webhooks.each do |webhook|
return if issue.project.nil?
issue.project.webhooks.each do |webhook|
next unless webhook.events["events"]["issues"]
_, _, @webhook_task = Webhook::IssueClient.new(webhook, issue, sender,"issues").do_request
Rails.logger.info "Touch Webhook Response result: #{@webhook_task.response_content}"
@ -18,6 +19,7 @@ class TouchWebhookJob < ApplicationJob
issue = Issue.find_by_id issue_id
sender = User.find_by_id sender_id
return if issue.nil? || sender.nil? || !changes.is_a?(Hash) || changes.blank?
return if issue.project.nil?
issue.project.webhooks.each do |webhook|
next unless webhook.events["events"]["issues"]
_, _, @webhook_task = Webhook::IssueClient.new(webhook, issue, sender, "issues", changes.stringify_keys).do_request
@ -29,6 +31,7 @@ class TouchWebhookJob < ApplicationJob
issue = Issue.find_by_id issue_id
sender = User.find_by_id sender_id
return if issue.nil? || sender.nil?
return if issue.project.nil?
issue.project.webhooks.each do |webhook|
next unless webhook.events["events"]["issue_assign"]
_, _, @webhook_task = Webhook::IssueClient.new(webhook, issue, sender, "issue_assign", changes.stringify_keys).do_request
@ -39,7 +42,8 @@ class TouchWebhookJob < ApplicationJob
issue_id, sender_id, changes = args[0], args[1], args[2]
issue = Issue.find_by_id issue_id
sender = User.find_by_id sender_id
return if issue.nil? || sender.nil?
return if issue.nil? || sender.nil?
return if issue.project.nil?
issue.project.webhooks.each do |webhook|
next unless webhook.events["events"]["issue_label"]
_, _, @webhook_task = Webhook::IssueClient.new(webhook, issue, sender, "issue_label", changes.stringify_keys).do_request
@ -53,6 +57,7 @@ class TouchWebhookJob < ApplicationJob
return if issue.nil? || sender.nil?
comment = issue.comment_journals.find_by_id comment_id
return if action_type == 'edited' && comment_json.blank?
return if issue.project.nil?
issue.project.webhooks.each do |webhook|
next unless webhook.events["events"]["issue_comment"]
@ -68,6 +73,7 @@ class TouchWebhookJob < ApplicationJob
return if issue.nil? || pull.nil? || sender.nil?
comment = issue.comment_journals.find_by_id comment_id
return if action_type == 'edited' && comment_json.blank?
return if issue.project.nil?
pull.project.webhooks.each do |webhook|
next unless webhook.events["events"]["pull_request_comment"]