mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
新增:评论丰富更新删除操作,issue事件粒度更细
This commit is contained in:
@@ -10,14 +10,14 @@ class TouchWebhookJob < ApplicationJob
|
||||
return if issue.nil? || sender.nil?
|
||||
issue.project.webhooks.each do |webhook|
|
||||
next unless webhook.events["events"]["issues"]
|
||||
_, _, @webhook_task = Webhook::IssueClient.new(webhook, issue, sender,"issues",).do_request
|
||||
_, _, @webhook_task = Webhook::IssueClient.new(webhook, issue, sender,"issues").do_request
|
||||
Rails.logger.info "Touch Webhook Response result: #{@webhook_task.response_content}"
|
||||
end
|
||||
when 'IssueUpdate'
|
||||
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? || !changes.is_a?(Hash)
|
||||
return if issue.nil? || sender.nil? || !changes.is_a?(Hash) || changes.blank?
|
||||
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
|
||||
@@ -47,29 +47,29 @@ class TouchWebhookJob < ApplicationJob
|
||||
end
|
||||
|
||||
when 'IssueComment'
|
||||
issue_id, sender_id, comment_id = args[0], args[1], args[2]
|
||||
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
|
||||
comment = issue.comment_journals.find_by_id comment_id
|
||||
sender = User.find_by_id sender_id
|
||||
return if issue.nil? || sender.nil? || comment.nil?
|
||||
return if issue.nil? || sender.nil?
|
||||
|
||||
issue.project.webhooks.each do |webhook|
|
||||
next unless webhook.events["events"]["issue_comment"]
|
||||
_, _, @webhook_task = Webhook::IssueCommentClient.new(webhook, issue, comment, sender, "issue_comment").do_request
|
||||
_, _, @webhook_task = Webhook::IssueCommentClient.new(webhook, issue, comment, sender, "issue_comment", action_type, comment_json).do_request
|
||||
Rails.logger.info "Touch Webhook Response result: #{@webhook_task.response_content}"
|
||||
end
|
||||
|
||||
when 'PullRequestComment'
|
||||
issue_id, sender_id, comment_id = args[0], args[1], args[2]
|
||||
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)
|
||||
comment = issue.comment_journals.find_by_id comment_id
|
||||
sender = User.find_by_id sender_id
|
||||
pull = issue.try(:pull_request)
|
||||
return if pull.nil? || sender.nil? || comment.nil?
|
||||
return if pull.nil? || sender.nil?
|
||||
|
||||
pull.project.webhooks.each do |webhook|
|
||||
next unless webhook.events["events"]["pull_request_comment"]
|
||||
_, _, @webhook_task = Webhook::PullCommentClient.new(webhook, pull, comment, sender, "pull_request_comment").do_request
|
||||
_, _, @webhook_task = Webhook::PullCommentClient.new(webhook, pull, comment, sender, "pull_request_comment", action_type, comment_json).do_request
|
||||
Rails.logger.info "Touch Webhook Response result: #{@webhook_task.response_content}"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user