Browse Source

fixed issue和评论里的附件解析关联,增强附件访问权限控制,切换到 项目保护

pull/347/head
xxq250 kingchan 2 years ago
parent
commit
9c7ad15e38
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      app/models/issue.rb
  2. +1
    -1
      app/models/journal.rb

+ 1
- 1
app/models/issue.rb View File

@@ -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



+ 1
- 1
app/models/journal.rb View File

@@ -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



Loading…
Cancel
Save