add: template email message

This commit is contained in:
2021-09-22 14:25:56 +08:00
parent 53212975f1
commit e5199425ee
24 changed files with 348 additions and 21 deletions

View File

@@ -27,4 +27,17 @@ class MessageTemplate::ProjectIssue < MessageTemplate
Rails.logger.info("MessageTemplate::ProjectIssue.get_message_content [ERROR] #{e}")
return '', '', ''
end
def self.get_email_message_content(managers, followers, operator, issue)
project = issue&.project
owner = project&.owner
receivers = managers + followers
content = email.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&.id.to_s)
return receivers_email_string(receivers), content, url
rescue => e
Rails.logger.info("MessageTemplate::ProjectIssue.get_email_message_content [ERROR] #{e}")
return '', '', ''
end
end