2021-09-09 16:32:13 +08:00
|
|
|
# == Schema Information
|
|
|
|
|
#
|
|
|
|
|
# Table name: message_templates
|
|
|
|
|
#
|
2021-09-14 17:39:58 +08:00
|
|
|
# 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)
|
2021-09-24 15:37:55 +08:00
|
|
|
# email_title :string(255)
|
2021-09-09 16:32:13 +08:00
|
|
|
#
|
|
|
|
|
|
|
|
|
|
# 在易修中@我
|
|
|
|
|
class MessageTemplate::IssueAtme < MessageTemplate
|
2021-09-14 23:04:33 +08:00
|
|
|
|
|
|
|
|
# MessageTemplate::IssueAtme.get_message_content(User.where(login: 'yystopf'), User.last, Issue.last)
|
|
|
|
|
def self.get_message_content(receivers, operator, issue)
|
|
|
|
|
project = issue&.project
|
|
|
|
|
owner = project&.owner
|
2021-09-16 16:54:49 +08:00
|
|
|
content = sys_notice.gsub('{nickname}', operator&.real_name).gsub('{title}', issue&.subject)
|
2021-09-15 18:55:58 +08:00
|
|
|
url = notification_url.gsub('{owner}', owner&.login).gsub('{identifier}', project&.identifier).gsub('{id}', issue&.id.to_s)
|
2021-09-14 23:04:33 +08:00
|
|
|
return receivers_string(receivers), content, url
|
|
|
|
|
rescue => e
|
|
|
|
|
Rails.logger.info("MessageTemplate::IssueAtme.get_message_content [ERROR] #{e}")
|
|
|
|
|
return 0, '', ''
|
|
|
|
|
end
|
2021-09-14 17:39:58 +08:00
|
|
|
end
|