From 10b258a9b01a6f25adc7a80e3e8e91c360cbe3a3 Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Fri, 23 Oct 2020 14:52:53 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=B6=88=E6=81=AF=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E8=AE=BE=E7=BD=AE=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notice/service/MailService.java | 6 +++-- .../track/service/TestCaseReviewService.java | 2 +- .../organization/TaskNotification.vue | 20 ++++++++++------- frontend/src/i18n/en-US.js | 3 ++- frontend/src/i18n/zh-CN.js | 3 ++- frontend/src/i18n/zh-TW.js | 22 ++++++++++--------- 6 files changed, 33 insertions(+), 23 deletions(-) diff --git a/backend/src/main/java/io/metersphere/notice/service/MailService.java b/backend/src/main/java/io/metersphere/notice/service/MailService.java index 9b7cf20490..0cc41c63e0 100644 --- a/backend/src/main/java/io/metersphere/notice/service/MailService.java +++ b/backend/src/main/java/io/metersphere/notice/service/MailService.java @@ -168,11 +168,11 @@ public class MailService { } } - +/*新建评审*/ public void sendReviewerNotice(MessageDetail messageDetail, List userIds, SaveTestCaseReviewRequest reviewRequest, String eventType) { Map context = getReviewContext(reviewRequest); try { - String reviewerTemplate = IOUtils.toString(this.getClass().getResource("/mail/end.html"), StandardCharsets.UTF_8); + String reviewerTemplate = IOUtils.toString(this.getClass().getResource("/mail/reviewer.html"), StandardCharsets.UTF_8); sendReviewNotice(addresseeIdList(messageDetail, userIds, eventType), context, reviewerTemplate); } catch (Exception e) { LogUtil.error(e); @@ -385,6 +385,8 @@ public class MailService { for (String k : context.keySet()) { if (StringUtils.isNotBlank(context.get(k))) { template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", context.get(k)); + }else{ + template = RegExUtils.replaceAll(template, "\\$\\{" + k + "}", ""); } } } diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java index fa7e5c46df..a3e0bee76a 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseReviewService.java @@ -459,7 +459,7 @@ public class TestCaseReviewService { wxChatTaskService.sendWechatRobot(r, userIds, context, NoticeConstants.UPDATE); break; case NoticeConstants.EMAIL: - mailService.sendReviewerNotice(r, userIds, testCaseReviewRequest, NoticeConstants.UPDATE); + mailService.sendEndNotice(r, userIds, testCaseReviewRequest, NoticeConstants.UPDATE); break; } }); diff --git a/frontend/src/business/components/settings/organization/TaskNotification.vue b/frontend/src/business/components/settings/organization/TaskNotification.vue index 3e0313a2fd..ab7692076c 100644 --- a/frontend/src/business/components/settings/organization/TaskNotification.vue +++ b/frontend/src/business/components/settings/organization/TaskNotification.vue @@ -568,14 +568,18 @@ export default { handleAddTask(index, data) { let list = [] if (data.event && data.userIds.length > 0 && data.type) { - data.isSet = false - list.push(data) - let param = {}; - param.messageDetail = list - this.result = this.$post("/notice/save/message/task", param, () => { - this.initForm() - this.$success(this.$t('commons.save_success')); - }) + if (data.type === 'NAIL_ROBOT' || data.type === 'NAIL_ROBOT') { + this.$warning(this.$t('organization.message.message_webhook')); + } else { + data.isSet = false + list.push(data) + let param = {}; + param.messageDetail = list + this.result = this.$post("/notice/save/message/task", param, () => { + this.initForm() + this.$success(this.$t('commons.save_success')); + }) + } } else { this.$warning(this.$t('organization.message.message')); } diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index a4d197da84..f2518841ad 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -234,7 +234,8 @@ export default { '\n' + '3. Robots are selected as swarm robots, and "custom keyword" is selected for security verification: "task notification"', message: 'Event, receiver and receiving method are required\n' + - '\n' + '\n', + message_webhook: 'Webhook is required when the receiving mode is nail or enterprise robot' }, integration: { select_defect_platform: 'Please select the defect management platform to be integrated:', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 92c3f20845..4f369a478b 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -232,7 +232,8 @@ export default { notes: '注意: 1.事件,接收方式,接收人为必填项;\n' + ' 2.接收方式除邮件外webhook为必填;\n' + ' 3.机器人选择为群机器人,安全验证选择“自定义关键词” :"任务通知"', - message: '事件,接收人,接收方式为必填项' + message: '事件,接收人,接收方式为必填项', + message_webhook: '接收方式为钉钉和企业机器人时,webhook为必填项' }, diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 0e48ea0c69..23fec07053 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -219,16 +219,18 @@ export default { defect_manage: '缺陷管理平臺', message_settings:'消息設定', message:{ - jenkins_task_notification:'Jenkins任務通知', - test_plan_task_notification:'測試計畫任務通知', - test_review_task_notice:'測試評審任務通知', - defect_task_notification:'缺陷任務通知', - create_new_notification:'創建新通知', - select_events:'選擇事件', - select_receiving_method:'選擇接收管道', - mail:'郵件', - nail_robot:'釘釘機器人', - enterprise_wechat_robot:'企業微信機器人', + jenkins_task_notification: 'Jenkins任務通知', + test_plan_task_notification: '測試計畫任務通知', + test_review_task_notice: '測試評審任務通知', + defect_task_notification: '缺陷任務通知', + create_new_notification: '創建新通知', + select_events: '選擇事件', + select_receiving_method: '選擇接收管道', + mail: '郵件', + nail_robot: '釘釘機器人', + enterprise_wechat_robot: '企業微信機器人', + message_webhook: '接收管道為釘釘和企業機器人時,webhook為必填項\n' + + '\n' }, integration: { select_defect_platform: '請選擇要集成的缺陷管理平臺:',