From 9c7ad15e3821a09b2268b5ee64495c0bb9bc8232 Mon Sep 17 00:00:00 2001 From: xxq250 Date: Tue, 24 Oct 2023 20:41:02 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20issue=E5=92=8C=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E9=87=8C=E7=9A=84=E9=99=84=E4=BB=B6=E8=A7=A3=E6=9E=90=E5=85=B3?= =?UTF-8?q?=E8=81=94=EF=BC=8C=E5=A2=9E=E5=BC=BA=E9=99=84=E4=BB=B6=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=9D=83=E9=99=90=E6=8E=A7=E5=88=B6,=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=88=B0=20=E9=A1=B9=E7=9B=AE=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/issue.rb | 2 +- app/models/journal.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/issue.rb b/app/models/issue.rb index d526b5102..6325a327f 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -231,7 +231,7 @@ class Issue < ApplicationRecord att_ids += self.description.to_s.scan(/\/api\/attachments\/.+\"/).map{|s|s.match(/\d+/)[0]} att_ids += self.description.to_s.scan(/\/api\/attachments\/\d+/).map{|s|s.match(/\d+/)[0]} if att_ids.present? - Attachment.where(id: att_ids).where(container_type: nil).update_all(container_id: self.id, container_type: self.class.name) + Attachment.where(id: att_ids).where("container_type IS NULL OR container_type = 'Issue'").update_all(container_id: self.project_id, container_type: "Project") end end diff --git a/app/models/journal.rb b/app/models/journal.rb index 3229ae886..30cd94143 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -67,7 +67,7 @@ class Journal < ApplicationRecord att_ids += self.notes.to_s.scan(/\/api\/attachments\/.+\"/).map{|s|s.match(/\d+/)[0]} att_ids += self.notes.to_s.scan(/\/api\/attachments\/\d+/).map{|s|s.match(/\d+/)[0]} if att_ids.present? - Attachment.where(id: att_ids).where(container_type: nil).update_all(container_id: self.id, container_type: self.class.name) + Attachment.where(id: att_ids).where("container_type IS NULL OR container_type = 'Journal'").update_all(container_id: self.issue.project_id, container_type: "Project") end end