From 1c27e9ccd87c28fbc0ad78a333faa3e8adbc8288 Mon Sep 17 00:00:00 2001 From: yystopf Date: Thu, 23 Sep 2021 17:08:53 +0800 Subject: [PATCH 1/5] fix: textarea md editor --- app/views/admins/message_templates/_form.html.erb | 7 +++---- app/views/admins/message_templates/edit.js.erb | 3 ++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/admins/message_templates/_form.html.erb b/app/views/admins/message_templates/_form.html.erb index ec640d1db..823c4408a 100644 --- a/app/views/admins/message_templates/_form.html.erb +++ b/app/views/admins/message_templates/_form.html.erb @@ -28,11 +28,10 @@
- <%= f.text_area :email, class:"form-control", rows: "10", cols: "20",placeholer: "邮件模版" %> +
+ <%= f.text_area :email, class:"form-control", style: 'display: none;', rows: "10", cols: "20", placeholer: "请输入邮件模版" %> +
- - -
-
+
+ +
+ <%= f.text_field :notification_url, class: "form-control input-lg", maxlength: "60", placeholder: "请输入站内信跳转地址" %> +
+ +
+
-
- -
- <%= f.text_field :notification_url, class: "form-control input-lg", maxlength: "60", placeholder: "请输入站内信跳转地址" %> -
-
<%= f.submit "确认", class: "btn btn-primary submit-btn" %>
diff --git a/app/views/admins/message_templates/edit.js.erb b/app/views/admins/message_templates/edit.js.erb index 8d22ddc02..5d797af2f 100644 --- a/app/views/admins/message_templates/edit.js.erb +++ b/app/views/admins/message_templates/edit.js.erb @@ -1,2 +1,2 @@ $("#admins-message-templates-content").html("<%= j render partial: 'admins/message_templates/form', locals:{type: 'update'} %>") -createMDEditor('message-template-email-editor', { height: 200, placeholder: '请输入邮件模版' }); +createMDEditor('message-template-email-editor', { height: 500, placeholder: '请输入邮件模版' }); From 3a22ece8717673ee1479e668584ea8c008ba90d9 Mon Sep 17 00:00:00 2001 From: yystopf Date: Sun, 26 Sep 2021 15:00:17 +0800 Subject: [PATCH 4/5] fix: orgainization left receiver email --- app/models/message_template/organization_left.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/message_template/organization_left.rb b/app/models/message_template/organization_left.rb index fc6ab2306..edf8b32ec 100644 --- a/app/models/message_template/organization_left.rb +++ b/app/models/message_template/organization_left.rb @@ -34,7 +34,7 @@ class MessageTemplate::OrganizationLeft < MessageTemplate content.gsub!('{login}', organization&.login) content.gsub!('{organization}', organization&.real_name) - return receiver, title, content + return receiver&.mail, title, content rescue => e Rails.logger.info("MessageTemplate::OrganizationLeft.get_email_message_content [ERROR] #{e}") return '', '', '' From be5b3864cd6bad91dbf7056805e65c7c7072fcd9 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 27 Sep 2021 11:25:12 +0800 Subject: [PATCH 5/5] fix: remove repeat message --- app/jobs/send_template_message_job.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/jobs/send_template_message_job.rb b/app/jobs/send_template_message_job.rb index bc080c689..2c463d705 100644 --- a/app/jobs/send_template_message_job.rb +++ b/app/jobs/send_template_message_job.rb @@ -146,7 +146,7 @@ class SendTemplateMessageJob < ApplicationJob user = User.find_by_id(user_id) project = Project.find_by_id(project_id) return unless operator.present? && user.present? && project.present? - receivers = project&.all_managers.where.not(id: operator&.id) + receivers = project&.all_managers.where.not(id: [operator&.id, user&.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.find_each do |receiver| @@ -159,7 +159,7 @@ class SendTemplateMessageJob < ApplicationJob user = User.find_by_id(user_id) project = Project.find_by_id(project_id) return unless operator.present? && user.present? && project.present? - receivers = project&.all_managers.where.not(id: operator&.id) + receivers = project&.all_managers.where.not(id: [operator&.id, user&.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.find_each do |receiver|