forked from Gitlink/forgeplus
fix
This commit is contained in:
parent
3ce8723de2
commit
c52f40adbd
|
@ -193,7 +193,7 @@ class SendTemplateMessageJob < ApplicationJob
|
|||
receivers_string, content, notification_url = MessageTemplate::ProjectRole.get_message_content(receivers, project, role)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, user_id: user.id, project_id: project.id, role: role})
|
||||
receivers.find_each do |receiver|
|
||||
receivers_email_string, email_title, email_content = MessageTemplate::ProjectRole.get_email_message_content(receivers, project, role)
|
||||
receivers_email_string, email_title, email_content = MessageTemplate::ProjectRole.get_email_message_content(receiver, project, role)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_title, email_content)
|
||||
end
|
||||
when 'ProjectSettingChanged'
|
||||
|
|
|
@ -19,7 +19,7 @@ class MessageTemplate::IssueAssigned < MessageTemplate
|
|||
def self.get_message_content(receivers, operator, issue)
|
||||
receivers.each do |receiver|
|
||||
if receiver.user_template_message_setting.present?
|
||||
receivers = receivers.where.not(id: receiver.id) unless receiver.user_template_message_setting.notification_body["CreateOrAssign::IssueAssigned"]
|
||||
receivers = receivers.where.not(id: receiver.id) unless receiver.user_template_message_setting.notification_body["Normal::IssueAssigned"]
|
||||
end
|
||||
end
|
||||
return '', '', '' if receivers.blank?
|
||||
|
@ -35,7 +35,7 @@ class MessageTemplate::IssueAssigned < MessageTemplate
|
|||
|
||||
def self.get_email_message_content(receiver, operator, issue)
|
||||
if receiver.user_template_message_setting.present?
|
||||
return '', '', '' unless receiver.user_template_message_setting.email_body["CreateOrAssign::IssueAssigned"]
|
||||
return '', '', '' unless receiver.user_template_message_setting.email_body["Normal::IssueAssigned"]
|
||||
end
|
||||
project = issue&.project
|
||||
owner = project&.owner
|
||||
|
|
|
@ -22,10 +22,10 @@ class MessageTemplate::ProjectIssue < MessageTemplate
|
|||
managers = managers.where.not(id: receiver.id) unless receiver.user_template_message_setting.notification_body["ManageProject::Issue"]
|
||||
end
|
||||
end
|
||||
return '', '', '' if receivers.blank?
|
||||
project = issue&.project
|
||||
owner = project&.owner
|
||||
receivers = managers + followers
|
||||
return '', '', '' if receivers.blank?
|
||||
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&.id.to_s)
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class MessageTemplate::ProjectRole < MessageTemplate
|
|||
return '', '', ''
|
||||
end
|
||||
|
||||
def self.get_email_message_content(receivers, project, role)
|
||||
def self.get_email_message_content(receiver, project, role)
|
||||
if receiver.user_template_message_setting.present?
|
||||
return '', '', '' unless receiver.user_template_message_setting.email_body["Normal::Permission"]
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ class MessageTemplate::PullRequestAssigned < MessageTemplate
|
|||
def self.get_message_content(receivers, operator, pull_request)
|
||||
receivers.each do |receiver|
|
||||
if receiver.user_template_message_setting.present?
|
||||
receivers = receivers.where.not(id: receiver.id) unless receiver.user_template_message_setting.notification_body["CreateOrAssign::PullRequestAssigned"]
|
||||
receivers = receivers.where.not(id: receiver.id) unless receiver.user_template_message_setting.notification_body["Normal::PullRequestAssigned"]
|
||||
end
|
||||
end
|
||||
return '', '', '' if receivers.blank?
|
||||
|
@ -35,7 +35,7 @@ class MessageTemplate::PullRequestAssigned < MessageTemplate
|
|||
|
||||
def self.get_email_message_content(receiver, operator, pull_request)
|
||||
if receiver.user_template_message_setting.present?
|
||||
return '', '', '' unless receiver.user_template_message_setting.email_body["CreateOrAssign::PullRequestAssigned"]
|
||||
return '', '', '' unless receiver.user_template_message_setting.email_body["Normal::PullRequestAssigned"]
|
||||
end
|
||||
project = pull_request&.project
|
||||
owner = project&.owner
|
||||
|
|
|
@ -24,7 +24,7 @@ class TemplateMessageSetting::Normal < TemplateMessageSetting
|
|||
end
|
||||
|
||||
def self.build_init_data
|
||||
self.find_or_create_by(name: "账号有权限变更", key: "Permission")
|
||||
# self.find_or_create_by(name: "账号有权限变更", key: "Permission")
|
||||
self.find_or_create_by(name: "被拉入或移出组织", key: "Organization")
|
||||
self.find_or_create_by(name: "被拉入或移出项目", key: "Project")
|
||||
self.find_or_create_by(name: "有新的易修指派给我", key: "IssueAssigned")
|
||||
|
|
|
@ -28,7 +28,7 @@ class UserTemplateMessageSetting < ApplicationRecord
|
|||
|
||||
def self.init_notification_body
|
||||
{
|
||||
"Normal::Permission": true,
|
||||
# "Normal::Permission": true,
|
||||
"Normal::Project": true,
|
||||
"Normal::Organization": true,
|
||||
"Normal::IssueAssigned": true,
|
||||
|
@ -42,7 +42,7 @@ class UserTemplateMessageSetting < ApplicationRecord
|
|||
|
||||
def self.init_email_body
|
||||
{
|
||||
"Normal::Permission": true,
|
||||
# "Normal::Permission": true,
|
||||
"Normal::Project": true,
|
||||
"Normal::Organization": true,
|
||||
"Normal::IssueAssigned": true,
|
||||
|
|
Loading…
Reference in New Issue