Merge branch 'standalone_develop' into pre_trustie_server

This commit is contained in:
xxq250 2025-03-25 15:41:24 +08:00
commit fe77a97057
2 changed files with 12 additions and 2 deletions

View File

@ -8,6 +8,7 @@ class TouchWebhookJob < ApplicationJob
issue = Issue.find_by_id issue_id issue = Issue.find_by_id issue_id
sender = User.find_by_id sender_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| issue.project.webhooks.each do |webhook|
next unless webhook.events["events"]["issues"] 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
@ -18,6 +19,7 @@ class TouchWebhookJob < ApplicationJob
issue = Issue.find_by_id issue_id issue = Issue.find_by_id issue_id
sender = User.find_by_id sender_id sender = User.find_by_id sender_id
return if issue.nil? || sender.nil? || !changes.is_a?(Hash) || changes.blank? return if issue.nil? || sender.nil? || !changes.is_a?(Hash) || changes.blank?
return if issue.project.nil?
issue.project.webhooks.each do |webhook| issue.project.webhooks.each do |webhook|
next unless webhook.events["events"]["issues"] next unless webhook.events["events"]["issues"]
_, _, @webhook_task = Webhook::IssueClient.new(webhook, issue, sender, "issues", changes.stringify_keys).do_request _, _, @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 issue = Issue.find_by_id issue_id
sender = User.find_by_id sender_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| issue.project.webhooks.each do |webhook|
next unless webhook.events["events"]["issue_assign"] next unless webhook.events["events"]["issue_assign"]
_, _, @webhook_task = Webhook::IssueClient.new(webhook, issue, sender, "issue_assign", changes.stringify_keys).do_request _, _, @webhook_task = Webhook::IssueClient.new(webhook, issue, sender, "issue_assign", changes.stringify_keys).do_request
@ -40,6 +43,7 @@ class TouchWebhookJob < ApplicationJob
issue = Issue.find_by_id issue_id issue = Issue.find_by_id issue_id
sender = User.find_by_id sender_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| issue.project.webhooks.each do |webhook|
next unless webhook.events["events"]["issue_label"] next unless webhook.events["events"]["issue_label"]
_, _, @webhook_task = Webhook::IssueClient.new(webhook, issue, sender, "issue_label", changes.stringify_keys).do_request _, _, @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? return if issue.nil? || sender.nil?
comment = issue.comment_journals.find_by_id comment_id comment = issue.comment_journals.find_by_id comment_id
return if action_type == 'edited' && comment_json.blank? return if action_type == 'edited' && comment_json.blank?
return if issue.project.nil?
issue.project.webhooks.each do |webhook| issue.project.webhooks.each do |webhook|
next unless webhook.events["events"]["issue_comment"] next unless webhook.events["events"]["issue_comment"]
@ -68,6 +73,7 @@ class TouchWebhookJob < ApplicationJob
return if issue.nil? || pull.nil? || sender.nil? return if issue.nil? || pull.nil? || sender.nil?
comment = issue.comment_journals.find_by_id comment_id comment = issue.comment_journals.find_by_id comment_id
return if action_type == 'edited' && comment_json.blank? return if action_type == 'edited' && comment_json.blank?
return if issue.project.nil?
pull.project.webhooks.each do |webhook| pull.project.webhooks.each do |webhook|
next unless webhook.events["events"]["pull_request_comment"] next unless webhook.events["events"]["pull_request_comment"]

View File

@ -85,6 +85,10 @@ class Api::V1::Issues::UpdateService < ApplicationService
@updated_issue.root_id = @root_id unless @root_id.nil? #不为 nil的时候更新 @updated_issue.root_id = @root_id unless @root_id.nil? #不为 nil的时候更新
@updated_issue.root_id = nil if @root_id.try(:zero?) #为 0 的时候设置为 nil @updated_issue.root_id = nil if @root_id.try(:zero?) #为 0 的时候设置为 nil
@updated_issue.time_scale = @time_scale unless @time_scale.nil? @updated_issue.time_scale = @time_scale unless @time_scale.nil?
if @project_id.present? && @project_id.to_i == 0
add_project = Project.find_by(id: @project_id)
@updated_issue.project_issues_index = add_project.get_last_project_issues_index + 1 if add_project.present?
end
@updated_issue.project_id = @project_id unless @project_id.nil? @updated_issue.project_id = @project_id unless @project_id.nil?
@updated_issue.updated_on = Time.now @updated_issue.updated_on = Time.now
@updated_issue.changer_id = @current_user.id @updated_issue.changer_id = @current_user.id