add: join message content be necessary

This commit is contained in:
2021-09-14 23:04:33 +08:00
parent ca4f416f0a
commit 65af40c29b
34 changed files with 542 additions and 18 deletions

View File

@@ -13,4 +13,14 @@
# 账号被拉入项目
class MessageTemplate::ProjectJoined < MessageTemplate
# MessageTemplate::ProjectJoined.get_message_content(User.where(login: 'yystopf'), Project.last)
def self.get_message_content(receivers, project)
content = sys_notice.gsub('{repository}', project&.name)
url = notification_url.gsub('{owner}', project&.owner&.login).gsub('{identifier}', project&.identifier)
return receivers_string(receivers), content, url
rescue => e
Rails.logger.info("MessageTemplate::ProjectJoined.get_message_content [ERROR] #{e}")
return '', '', ''
end
end