diff --git a/app/jobs/touch_webhook_job.rb b/app/jobs/touch_webhook_job.rb index bd5bae343..740632700 100644 --- a/app/jobs/touch_webhook_job.rb +++ b/app/jobs/touch_webhook_job.rb @@ -6,7 +6,6 @@ class TouchWebhookJob < ApplicationJob when 'IssueCreate' issue_id, sender_id = args[0], args[1] issue = Issue.find_by_id issue_id - return if issue.nil? sender = User.find_by_id sender_id return if issue.nil? || sender.nil? issue.project.webhooks.each do |webhook| @@ -17,7 +16,6 @@ class TouchWebhookJob < ApplicationJob when 'IssueUpdate' issue_id, sender_id, changes = args[0], args[1], args[2] issue = Issue.find_by_id issue_id - return if issue.nil? sender = User.find_by_id sender_id return if issue.nil? || sender.nil? || !changes.is_a?(Hash) || changes.blank? issue.project.webhooks.each do |webhook| @@ -29,7 +27,6 @@ class TouchWebhookJob < ApplicationJob when 'IssueAssign' issue_id, sender_id, changes = args[0], args[1], args[2] issue = Issue.find_by_id issue_id - return if issue.nil? sender = User.find_by_id sender_id return if issue.nil? || sender.nil? issue.project.webhooks.each do |webhook| @@ -41,7 +38,6 @@ class TouchWebhookJob < ApplicationJob when 'IssueLabel' issue_id, sender_id, changes = args[0], args[1], args[2] issue = Issue.find_by_id issue_id - return if issue.nil? sender = User.find_by_id sender_id return if issue.nil? || sender.nil? issue.project.webhooks.each do |webhook| @@ -53,10 +49,9 @@ class TouchWebhookJob < ApplicationJob when 'IssueComment' issue_id, sender_id, comment_id, action_type, comment_json = args[0], args[1], args[2], args[3], args[4] issue = Issue.find_by_id issue_id - return if issue.nil? - comment = issue.comment_journals.find_by_id comment_id sender = User.find_by_id sender_id - return if issue.nil? || sender.nil? + return if issue.nil? || sender.nil? + comment = issue.comment_journals.find_by_id comment_id return if action_type == 'edited' && comment_json.blank? issue.project.webhooks.each do |webhook| @@ -68,11 +63,10 @@ class TouchWebhookJob < ApplicationJob when 'PullRequestComment' issue_id, sender_id, comment_id, action_type, comment_json = args[0], args[1], args[2], args[3], args[4] issue = Issue.find_by_id(issue_id) - return if issue.nil? - comment = issue.comment_journals.find_by_id comment_id sender = User.find_by_id sender_id + return if pull.nil? || sender.nil? + comment = issue.comment_journals.find_by_id comment_id pull = issue.try(:pull_request) - return if pull.nil? || sender.nil? return if action_type == 'edited' && comment_json.blank? pull.project.webhooks.each do |webhook|