新增:更改来源解析url

This commit is contained in:
yystopf 2024-10-21 11:17:31 +08:00
parent 151e028d34
commit 256f29b7f4
1 changed files with 13 additions and 2 deletions

View File

@ -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 "通过<a =\"#{Rails.application.config_for(:configuration)['platform_url']}/#{project&.owner&.login}/#{project&.identifier}/commits/#{commit_sha}\">#{project&.owner&.real_name}/#{project&.name}</a>"
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'