From 256f29b7f4c3554c605d8a91c47df78f53c4e0a9 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 21 Oct 2024 11:17:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E6=9D=A5=E6=BA=90=E8=A7=A3=E6=9E=90url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journal.rb | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/models/journal.rb b/app/models/journal.rb index b3a699c8f..f7f6800dc 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -83,6 +83,17 @@ class Journal < ApplicationRecord end end + def operate_by_content + return '' if self.operate_by == "Issue" + if self.operate_by.starts_with?("Project#") + project_id, commit_sha = self.operate_by.scan(/#(\d+).*?@(\w+)/)[0] + project =Project.find_by_id(project_id) + return "通过#{project&.owner&.real_name}/#{project&.name}" + end + rescue + return '' + end + def pm_operate_category detail = self.journal_details.take if %w(requirement task bug).include?(detail.property) && detail.prop_key.to_s == "1" @@ -93,7 +104,7 @@ class Journal < ApplicationRecord end def pm_operate_content - content = "" + content = "#{operate_by_content}" detail = self.journal_details.take case detail.property when 'requirement' @@ -501,7 +512,7 @@ class Journal < ApplicationRecord end def operate_content - content = "" + content = "#{operate_by_content}" detail = self.journal_details.take case detail.property when 'issue'