From 656fb9a2a6d295b8084fb2e429096bc338c1635d Mon Sep 17 00:00:00 2001 From: xxq250 Date: Mon, 24 Mar 2025 13:53:14 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fixed=20=E9=A1=B9=E7=9B=AE=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E4=B8=8D=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/touch_webhook_job.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/jobs/touch_webhook_job.rb b/app/jobs/touch_webhook_job.rb index 514fa6950..0446b8f4a 100644 --- a/app/jobs/touch_webhook_job.rb +++ b/app/jobs/touch_webhook_job.rb @@ -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"] From cd32a3ab6c205fc32cfe690c7d8ffdbcb0999c5e Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 25 Mar 2025 15:40:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fixed=20=E5=B7=A5=E4=BD=9C=E9=A1=B9?= =?UTF-8?q?=E5=8A=A0=E5=88=B0=E9=A1=B9=E7=9B=AE=E6=97=B6project=5Fissues?= =?UTF-8?q?=5Findex=E9=87=8D=E6=8E=92=E5=BA=8F=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/api/v1/issues/update_service.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/services/api/v1/issues/update_service.rb b/app/services/api/v1/issues/update_service.rb index 4b8961854..6d2bbedf0 100644 --- a/app/services/api/v1/issues/update_service.rb +++ b/app/services/api/v1/issues/update_service.rb @@ -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 = nil if @root_id.try(:zero?) #为 0 的时候设置为 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.updated_on = Time.now @updated_issue.changer_id = @current_user.id