修复:journal来源解析

This commit is contained in:
yystopf 2024-10-21 11:29:48 +08:00
parent 256f29b7f4
commit 12c020f315
1 changed files with 15 additions and 13 deletions

View File

@ -88,7 +88,7 @@ class Journal < ApplicationRecord
if self.operate_by.starts_with?("Project#") if self.operate_by.starts_with?("Project#")
project_id, commit_sha = self.operate_by.scan(/#(\d+).*?@(\w+)/)[0] project_id, commit_sha = self.operate_by.scan(/#(\d+).*?@(\w+)/)[0]
project =Project.find_by_id(project_id) 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>" return "通过<a =\"#{Rails.application.config_for(:configuration)['platform_url']}/#{project&.owner&.login}/#{project&.identifier}/commits/#{commit_sha}\">#{project&.owner&.real_name}/#{project&.name} 提交 #{commit_sha[0...10]}</a>"
end end
rescue rescue
return '' return ''
@ -165,7 +165,7 @@ class Journal < ApplicationRecord
end end
return content return content
else else
return "创建了需求" content += "创建了需求"
end end
when 'task' when 'task'
case detail.prop_key case detail.prop_key
@ -225,7 +225,7 @@ class Journal < ApplicationRecord
end end
return content return content
else else
return "创建了任务" content += "创建了任务"
end end
when 'bug' when 'bug'
case detail.prop_key case detail.prop_key
@ -285,14 +285,14 @@ class Journal < ApplicationRecord
end end
return content return content
else else
return "创建了缺陷" content += "创建了缺陷"
end end
when 'attr' when 'attr'
case detail.prop_key case detail.prop_key
when 'subject' when 'subject'
return "修改了<b>标题</b>" content += "修改了<b>标题</b>"
when 'description' when 'description'
return "修改了<b>正文</b>" content += "修改了<b>正文</b>"
when 'priority_id' when 'priority_id'
old_value = IssuePriority.find_by_id(detail.old_value)&.name old_value = IssuePriority.find_by_id(detail.old_value)&.name
new_value = IssuePriority.find_by_id(detail.value)&.name new_value = IssuePriority.find_by_id(detail.value)&.name
@ -502,13 +502,15 @@ class Journal < ApplicationRecord
issue = self.issue issue = self.issue
case issue.pm_issue_type case issue.pm_issue_type
when 1 when 1
return "创建了需求" content += "创建了需求"
when 2 when 2
return "创建了任务" content += "创建了任务"
when 3 when 3
return "创建了缺陷" content += "创建了缺陷"
end end
end end
return content
end end
def operate_content def operate_content
@ -516,7 +518,7 @@ class Journal < ApplicationRecord
detail = self.journal_details.take detail = self.journal_details.take
case detail.property case detail.property
when 'issue' when 'issue'
return "创建了<b>疑修</b>" content += "创建了<b>疑修</b>"
when 'attachment' when 'attachment'
old_value = Attachment.where("BINARY id in (?) or uuid in (?)", detail.old_value.to_s.split(","), detail.old_value.to_s.split(",")).pluck(:filename).join("") old_value = Attachment.where("BINARY id in (?) or uuid in (?)", detail.old_value.to_s.split(","), detail.old_value.to_s.split(",")).pluck(:filename).join("")
new_value = Attachment.where("BINARY id in (?) or uuid in (?)", detail.value.to_s.split(","), detail.value.to_s.split(",")).pluck(:filename).join("") new_value = Attachment.where("BINARY id in (?) or uuid in (?)", detail.value.to_s.split(","), detail.value.to_s.split(",")).pluck(:filename).join("")
@ -545,12 +547,12 @@ class Journal < ApplicationRecord
content += "将负责人由<b>#{old_value}</b>更改为<b>#{new_value}</b>" content += "将负责人由<b>#{old_value}</b>更改为<b>#{new_value}</b>"
end end
when 'attr' when 'attr'
content = "" content += ""
case detail.prop_key case detail.prop_key
when 'subject' when 'subject'
return "修改了<b>标题</b>" content += "修改了<b>标题</b>"
when 'description' when 'description'
return "修改了<b>描述</b>" content += "修改了<b>描述</b>"
when 'status_id' when 'status_id'
old_value = IssueStatus.find_by_id(detail.old_value)&.name old_value = IssueStatus.find_by_id(detail.old_value)&.name
new_value = IssueStatus.find_by_id(detail.value)&.name new_value = IssueStatus.find_by_id(detail.value)&.name