mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-16 01:35:56 +08:00
新增:声明感知消息
This commit is contained in:
31
app/models/message_template/issue_claim.rb
Normal file
31
app/models/message_template/issue_claim.rb
Normal file
@@ -0,0 +1,31 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: message_templates
|
||||
#
|
||||
# id :integer not null, primary key
|
||||
# type :string(255)
|
||||
# sys_notice :text(65535)
|
||||
# email :text(65535)
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# notification_url :string(255)
|
||||
# email_title :string(255)
|
||||
#
|
||||
|
||||
# 在疑修中创建声明
|
||||
class MessageTemplate::IssueClaim < MessageTemplate
|
||||
|
||||
# MessageTemplate::IssueAtme.get_message_content(User.where(login: 'yystopf'), User.last, Issue.last)
|
||||
def self.get_message_content(receivers, operator, issue)
|
||||
return '', '', '' if receivers.blank?
|
||||
project = issue&.project
|
||||
owner = project&.owner
|
||||
content = sys_notice.gsub('{nickname1}', operator&.real_name).gsub('{nickname2}', owner&.real_name).gsub('{repository}', project&.name).gsub('{title}', issue&.subject)
|
||||
url = notification_url.gsub('{owner}', owner&.login).gsub('{identifier}', project&.identifier).gsub('{id}', issue&.project_issues_index.to_s)
|
||||
|
||||
return receivers_string(receivers), content, url
|
||||
rescue => e
|
||||
Rails.logger.info("MessageTemplate::IssueClaim.get_message_content [ERROR] #{e}")
|
||||
return 0, '', ''
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user