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'