mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-02 19:30:48 +08:00
add: template email message
This commit is contained in:
@@ -20,6 +20,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = User.where(id: issue&.assigned_to_id).where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::IssueAssigned.get_message_content(receivers, operator, issue)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, issue_id: issue.id})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::IssueAssigned.get_email_message_content(receivers, operator, issue)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'IssueAssignerExpire'
|
||||
issue_id = args[0]
|
||||
issue = Issue.find_by_id(issue_id)
|
||||
@@ -65,6 +67,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = User.where(id: user.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::OrganizationJoined.get_message_content(receivers, organization)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user.id, organization_id: organization.id})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::OrganizationJoined.get_email_message_content(receivers, organization)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'OrganizationLeft'
|
||||
user_id, organization_id = args[0], args[1]
|
||||
user = User.find_by_id(user_id)
|
||||
@@ -73,6 +77,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = User.where(id: user.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::OrganizationLeft.get_message_content(receivers, organization)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user.id, organization_id: organization.id})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::OrganizationLeft.get_email_message_content(receivers, organization)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'OrganizationRole'
|
||||
user_id, organization_id, role = args[0], args[1], args[2]
|
||||
user = User.find_by_id(user_id)
|
||||
@@ -81,6 +87,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = User.where(id: user.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::OrganizationRole.get_message_content(receivers, organization, role)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {user_id: user.id, organization_id: organization.id, role: role})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::OrganizationRole.get_email_message_content(receivers, organization, role)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'ProjectIssue'
|
||||
operator_id, issue_id = args[0], args[1]
|
||||
operator = User.find_by_id(operator_id)
|
||||
@@ -90,6 +98,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
followers = [] # TODO
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectIssue.get_message_content(managers, followers, operator, issue)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, issue_id: issue.id})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::ProjectIssue.get_email_message_content(managers, followers, operator, issue)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'ProjectJoined'
|
||||
operator_id, user_id, project_id = args[0], args[1], args[2]
|
||||
operator = User.find_by_id(operator_id)
|
||||
@@ -99,6 +109,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = User.where(id: user.id).where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectJoined.get_message_content(receivers, project)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, user_id: user.id, project_id: project.id})
|
||||
receivers_emal_string, email_content, notification_url = MessageTemplate::ProjectJoined.get_email_message_content(receivers, project)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'ProjectLeft'
|
||||
operator_id, user_id, project_id = args[0], args[1], args[2]
|
||||
operator = User.find_by_id(operator_id)
|
||||
@@ -108,6 +120,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = User.where(id: user.id).where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectLeft.get_message_content(receivers, project)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, user_id: user.id, project_id: project.id})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::ProjectLeft.get_email_message_content(receivers, project)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'ProjectMemberJoined'
|
||||
operator_id, user_id, project_id = args[0], args[1], args[2]
|
||||
operator = User.find_by_id(operator_id)
|
||||
@@ -117,6 +131,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = project&.all_managers.where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectMemberJoined.get_message_content(receivers, user, project)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, user_id: user.id, project_id: project.id})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::ProjectMemberJoined.get_email_message_content(receivers, user, project)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'ProjectMemberLeft'
|
||||
operator_id, user_id, project_id = args[0], args[1], args[2]
|
||||
operator = User.find_by_id(operator_id)
|
||||
@@ -126,6 +142,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = project&.all_managers.where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectMemberLeft.get_message_content(receivers, user, project)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, user_id: user.id, project_id: project.id})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::ProjectMemberLeft.get_email_message_content(receivers, user, project)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'ProjectPullRequest'
|
||||
operator_id, pull_request_id = args[0], args[1]
|
||||
operator = User.find_by_id(operator_id)
|
||||
@@ -135,6 +153,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
followers = [] # TODO
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectPullRequest.get_message_content(managers, followers, operator, pull_request)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, pull_request_id: pull_request.id})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::ProjectPullRequest.get_email_message_content(managers, followers, operator, pull_request)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'ProjectRole'
|
||||
operator_id, user_id, project_id, role = args[0], args[1], args[2], args[3]
|
||||
operator = User.find_by_id(operator_id)
|
||||
@@ -144,6 +164,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = User.where(id: user.id).where.not(id: operator&.id)
|
||||
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_email_string, email_content, notification_url = MessageTemplate::ProjectRole.get_email_message_content(receivers, project, role)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'ProjectSettingChanged'
|
||||
operator_id, project_id, change_params = args[0], args[1], args[2]
|
||||
operator = User.find_by_id(operator_id)
|
||||
@@ -152,6 +174,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = project.all_managers.where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::ProjectSettingChanged.get_message_content(receivers, operator, project, change_params.symbolize_keys)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, project_id: project.id, change_params: change_params})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::ProjectSettingChanged.get_email_message_content(receivers, operator, project, change_params.symbolize_keys)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'PullRequestAssigned'
|
||||
operator_id, pull_request_id = args[0], args[1]
|
||||
operator = User.find_by_id(operator_id)
|
||||
@@ -161,6 +185,8 @@ class SendTemplateMessageJob < ApplicationJob
|
||||
receivers = User.where(id: issue&.assigned_to_id).where.not(id: operator&.id)
|
||||
receivers_string, content, notification_url = MessageTemplate::PullRequestAssigned.get_message_content(receivers, operator, pull_request)
|
||||
Notice::Write::CreateService.call(receivers_string, content, notification_url, source, {operator_id: operator.id, pull_request_id: pull_request.id})
|
||||
receivers_email_string, email_content, notification_url = MessageTemplate::PullRequestAssigned.get_email_message_content(receivers, operator, pull_request)
|
||||
Notice::Write::EmailCreateService.call(receivers_email_string, email_content, source)
|
||||
when 'PullRequestAtme'
|
||||
receivers, operator_id, pull_request_id = args[0], args[1], args[2]
|
||||
operator = User.find_by_id(operator_id)
|
||||
|
||||
Reference in New Issue
Block a user