From 4ba24afeee1fad377a437e37a14cc376129b4e9d Mon Sep 17 00:00:00 2001 From: wenyann <64353056+wenyann@users.noreply.github.com> Date: Mon, 23 Nov 2020 12:36:33 +0800 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../notice/service/MailService.java | 10 +++++-- .../service/SystemParameterService.java | 2 ++ .../components/DefectTaskNotification.vue | 14 +++++----- .../components/JenkinsNotification.vue | 28 +++++++++---------- .../components/ScheduleTaskNotification.vue | 20 ++++++------- .../components/TestPlanTaskNotification.vue | 14 +++++----- .../components/TestReviewNotification.vue | 28 +++++++++---------- 7 files changed, 61 insertions(+), 55 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 0cc1c5e44e..b4237af8ff 100644 --- a/backend/src/main/java/io/metersphere/notice/service/MailService.java +++ b/backend/src/main/java/io/metersphere/notice/service/MailService.java @@ -112,6 +112,7 @@ public class MailService { emails.add(u.getEmail()); }); users = emails.toArray(new String[0]); + LogUtil.info("收件人地址"+users); helper.setText(getContent(Template, context), true); helper.setTo(users); try { @@ -195,7 +196,8 @@ public class MailService { public void sendTestPlanStartNotice(MessageDetail messageDetail, List userIds, AddTestPlanRequest testPlan, String eventType) { Map context = getTestPlanContext(testPlan); - context.put("creator", testPlan.getCreator()); + User user = userMapper.selectByPrimaryKey(testPlan.getCreator()); + context.put("creator", user.getName()); try { String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanStart.html"), StandardCharsets.UTF_8); sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate); @@ -205,8 +207,9 @@ public class MailService { } public void sendTestPlanEndNotice(MessageDetail messageDetail, List userIds, AddTestPlanRequest testPlan, String eventType) { + User user = userMapper.selectByPrimaryKey(testPlan.getCreator()); Map context = getTestPlanContext(testPlan); - context.put("creator", userIds.toString()); + context.put("creator", user.getName()); try { String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanEnd.html"), StandardCharsets.UTF_8); sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate); @@ -216,8 +219,9 @@ public class MailService { } public void sendTestPlanDeleteNotice(MessageDetail messageDetail, List userIds, AddTestPlanRequest testPlan, String eventType) { + User user = userMapper.selectByPrimaryKey(testPlan.getCreator()); Map context = getTestPlanContext(testPlan); - context.put("creator", userIds.toString()); + context.put("creator", user.getName()); try { String endTemplate = IOUtils.toString(this.getClass().getResource("/mail/TestPlanDelete.html"), StandardCharsets.UTF_8); sendTestPlanNotice(addresseeIdList(messageDetail, userIds, eventType), context, endTemplate); diff --git a/backend/src/main/java/io/metersphere/service/SystemParameterService.java b/backend/src/main/java/io/metersphere/service/SystemParameterService.java index 680a0886e0..5e459afb0b 100644 --- a/backend/src/main/java/io/metersphere/service/SystemParameterService.java +++ b/backend/src/main/java/io/metersphere/service/SystemParameterService.java @@ -7,6 +7,7 @@ import io.metersphere.base.mapper.ext.ExtSystemParameterMapper; import io.metersphere.commons.constants.ParamConstants; import io.metersphere.commons.exception.MSException; import io.metersphere.commons.utils.EncryptUtils; +import io.metersphere.commons.utils.LogUtil; import io.metersphere.dto.BaseSystemConfigDTO; import io.metersphere.i18n.Translator; import io.metersphere.ldap.domain.LdapInfo; @@ -99,6 +100,7 @@ public class SystemParameterService { try { javaMailSender.testConnection(); } catch (MessagingException e) { + LogUtil.error(e); MSException.throwException(Translator.get("connection_failed")); } } diff --git a/frontend/src/business/components/settings/organization/components/DefectTaskNotification.vue b/frontend/src/business/components/settings/organization/components/DefectTaskNotification.vue index afbe065141..aa17e59edb 100644 --- a/frontend/src/business/components/settings/organization/components/DefectTaskNotification.vue +++ b/frontend/src/business/components/settings/organization/components/DefectTaskNotification.vue @@ -145,26 +145,26 @@ export default { data.isReadOnly = true; if (data.type === 'EMAIL') { data.isReadOnly = !data.isReadOnly - data.webhook = "" + data.webhook = '' } }, handleEditTask(index,data) { data.isSet = true if (data.type === 'EMAIL') { - data.isReadOnly = false - data.webhook = "" + data.isReadOnly = false; + data.webhook = '' } else { - data.isReadOnly = true + data.isReadOnly = true; } }, handleAddTaskModel(type) { let Task = {}; Task.event = []; Task.userIds = []; - Task.type = ""; - Task.webhook = ""; + Task.type = ''; + Task.webhook = ''; Task.isSet = true; - Task.identification = ""; + Task.identification = ''; if (type === 'jenkinsTask') { Task.taskType = 'JENKINS_TASK' this.form.jenkinsTask.push(Task) diff --git a/frontend/src/business/components/settings/organization/components/JenkinsNotification.vue b/frontend/src/business/components/settings/organization/components/JenkinsNotification.vue index 3f8ee42142..3cf5f91f2a 100644 --- a/frontend/src/business/components/settings/organization/components/JenkinsNotification.vue +++ b/frontend/src/business/components/settings/organization/components/JenkinsNotification.vue @@ -146,18 +146,18 @@ export default { handleEdit(index, data) { data.isReadOnly = true; if (data.type === 'EMAIL') { - data.isReadOnly = !data.isReadOnly - data.webhook = "" + data.isReadOnly = !data.isReadOnly; + data.webhook = ''; } }, handleAddTaskModel(type) { let Task = {}; Task.event = []; Task.userIds = []; - Task.type = ""; - Task.webhook = ""; + Task.type = ''; + Task.webhook = ''; Task.isSet = true; - Task.identification = ""; + Task.identification = ''; if (type === 'jenkinsTask') { Task.taskType = 'JENKINS_TASK' this.form.jenkinsTask.push(Task) @@ -194,21 +194,21 @@ export default { handleEditTask(index,data) { data.isSet = true if (data.type === 'EMAIL') { - data.isReadOnly = false - data.webhook = "" + data.isReadOnly = false; + data.webhook = '' } else { - data.isReadOnly = true + data.isReadOnly = true; } }, addTask(data) { - let list = [] - data.isSet = false - list.push(data) + let list = []; + data.isSet = false; + list.push(data); let param = {}; - param.messageDetail = list + param.messageDetail = list; this.result = this.$post("/notice/save/message/task", param, () => { - this.initForm() + this.initForm(); this.$success(this.$t('commons.save_success')); }) }, @@ -216,7 +216,7 @@ export default { if (!data[index].identification) { data.splice(index, 1) } else { - data[index].isSet = false + data[index].isSet = false; } }, diff --git a/frontend/src/business/components/settings/organization/components/ScheduleTaskNotification.vue b/frontend/src/business/components/settings/organization/components/ScheduleTaskNotification.vue index d269a1fc2b..8cc7cb175c 100644 --- a/frontend/src/business/components/settings/organization/components/ScheduleTaskNotification.vue +++ b/frontend/src/business/components/settings/organization/components/ScheduleTaskNotification.vue @@ -147,8 +147,8 @@ export default { handleEdit(index, data) { data.isReadOnly = true; if (data.type === 'EMAIL') { - data.isReadOnly = !data.isReadOnly - data.webhook = "" + data.isReadOnly = !data.isReadOnly; + data.webhook = '' } }, handleAddTaskModel(type) { @@ -166,13 +166,13 @@ export default { } }, handleEditTask(index,data) { - data.isSet = true - data.testId = this.testId + data.isSet = true; + data.testId = this.testId; if (data.type === 'EMAIL') { - data.isReadOnly = false - data.webhook = "" + data.isReadOnly = false; + data.webhook = '' } else { - data.isReadOnly = true + data.isReadOnly = true; } }, handleAddTask(index, data) { @@ -192,9 +192,9 @@ export default { } }, addTask(data) { - let list = [] - data.isSet = false - list.push(data) + let list = []; + data.isSet = false; + list.push(data); let param = {}; param.messageDetail = list this.result = this.$post("/notice/save/message/task", param, () => { diff --git a/frontend/src/business/components/settings/organization/components/TestPlanTaskNotification.vue b/frontend/src/business/components/settings/organization/components/TestPlanTaskNotification.vue index 51aaada805..fa8182ea54 100644 --- a/frontend/src/business/components/settings/organization/components/TestPlanTaskNotification.vue +++ b/frontend/src/business/components/settings/organization/components/TestPlanTaskNotification.vue @@ -151,26 +151,26 @@ export default { data.isReadOnly = true; if (data.type === 'EMAIL') { data.isReadOnly = !data.isReadOnly - data.webhook = "" + data.webhook = ''; } }, handleEditTask(index,data) { data.isSet = true if (data.type === 'EMAIL') { - data.isReadOnly = false - data.webhook = "" + data.isReadOnly = false; + data.webhook = ''; } else { - data.isReadOnly = true + data.isReadOnly = true; } }, handleAddTaskModel(type) { let Task = {}; Task.event = []; Task.userIds = []; - Task.type = ""; - Task.webhook = ""; + Task.type = ''; + Task.webhook = ''; Task.isSet = true; - Task.identification = ""; + Task.identification = ''; if (type === 'jenkinsTask') { Task.taskType = 'JENKINS_TASK' this.form.jenkinsTask.push(Task) diff --git a/frontend/src/business/components/settings/organization/components/TestReviewNotification.vue b/frontend/src/business/components/settings/organization/components/TestReviewNotification.vue index a02d7c82c6..3dce2c54a9 100644 --- a/frontend/src/business/components/settings/organization/components/TestReviewNotification.vue +++ b/frontend/src/business/components/settings/organization/components/TestReviewNotification.vue @@ -151,27 +151,27 @@ export default { handleEdit(index, data) { data.isReadOnly = true; if (data.type === 'EMAIL') { - data.isReadOnly = !data.isReadOnly - data.webhook = "" + data.isReadOnly = !data.isReadOnly; + data.webhook = ''; } }, handleEditTask(index,data) { - data.isSet = true + data.isSet = true; if (data.type === 'EMAIL') { - data.isReadOnly = false - data.webhook = "" + data.isReadOnly = false; + data.webhook = ''; } else { - data.isReadOnly = true + data.isReadOnly = true; } }, handleAddTaskModel(type) { let Task = {}; Task.event = []; Task.userIds = []; - Task.type = ""; - Task.webhook = ""; + Task.type = ''; + Task.webhook = ''; Task.isSet = true; - Task.identification = ""; + Task.identification = ''; if (type === 'jenkinsTask') { Task.taskType = 'JENKINS_TASK' this.form.jenkinsTask.push(Task) @@ -207,13 +207,13 @@ export default { } }, addTask(data) { - let list = [] - data.isSet = false - list.push(data) + let list = []; + data.isSet = false; + list.push(data); let param = {}; - param.messageDetail = list + param.messageDetail = list; this.result = this.$post("/notice/save/message/task", param, () => { - this.initForm() + this.initForm(); this.$success(this.$t('commons.save_success')); }) }, From ea3895d31556d8e194d863e735ea1a21da0a3084 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 23 Nov 2020 14:44:54 +0800 Subject: [PATCH 2/6] =?UTF-8?q?refactor:=20=E5=88=A0=E9=99=A4=E6=97=A0?= =?UTF-8?q?=E7=94=A8=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/components/track/plan/components/TestPlanEdit.vue | 3 --- .../business/components/track/plan/components/TestPlanList.vue | 2 -- .../track/review/view/components/TestReviewRelevance.vue | 1 - .../track/review/view/components/TestReviewTestCaseEdit.vue | 2 +- .../track/review/view/components/TestReviewTestCaseList.vue | 1 - 5 files changed, 1 insertion(+), 8 deletions(-) diff --git a/frontend/src/business/components/track/plan/components/TestPlanEdit.vue b/frontend/src/business/components/track/plan/components/TestPlanEdit.vue index b50c8ed87f..3ac4fc0864 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanEdit.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanEdit.vue @@ -58,11 +58,8 @@ - - - diff --git a/frontend/src/business/components/track/plan/components/TestPlanList.vue b/frontend/src/business/components/track/plan/components/TestPlanList.vue index c3459c4d44..3f9d82821d 100644 --- a/frontend/src/business/components/track/plan/components/TestPlanList.vue +++ b/frontend/src/business/components/track/plan/components/TestPlanList.vue @@ -208,11 +208,9 @@ export default { methods: { initTableData() { if (this.planId) { - // param.planId = this.planId; this.condition.planId = this.planId; } if (this.selectNodeIds && this.selectNodeIds.length > 0) { - // param.nodeIds = this.selectNodeIds; this.condition.nodeIds = this.selectNodeIds; } this.result = this.$post(this.buildPagePath(this.queryPath), this.condition, response => { diff --git a/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue b/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue index 8e532c480c..9c965c1fb1 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewRelevance.vue @@ -231,7 +231,6 @@ this.selectIds.add(item.id); }); } else { - // this.selectIds.clear(); this.testReviews.forEach(item => { if (this.selectIds.has(item.id)) { this.selectIds.delete(item.id); diff --git a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue index db26dcae91..3a55a66aaa 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseEdit.vue @@ -389,7 +389,7 @@ export default { this.saveReport(reportId); }, saveReport(reportId) { - // this.$post('/test/plan/case/edit', {id: this.testCase.id, reportId: reportId}); + }, getComments(testCase) { let id = ''; diff --git a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue index b0e3061dd5..cdf59070ff 100644 --- a/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue +++ b/frontend/src/business/components/track/review/view/components/TestReviewTestCaseList.vue @@ -301,7 +301,6 @@ export default { return path + "/" + this.currentPage + "/" + this.pageSize; }, handleEdit(testCase, index) { - // console.log(testCase) this.isReadOnly = false; if (!checkoutTestManagerOrTestUser()) { this.isReadOnly = true; From ab0f3535f80c5ef17bfb99c158f7c0d02722f44a Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 23 Nov 2020 16:44:02 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E4=BF=AE=E6=94=B9=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E9=82=AE=E7=AE=B1=E6=97=B6=E5=8F=AF=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=B7=B2=E5=AD=98=E5=9C=A8=E9=82=AE=E7=AE=B1?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/service/UserService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/backend/src/main/java/io/metersphere/service/UserService.java b/backend/src/main/java/io/metersphere/service/UserService.java index 6a20ed42c3..ebb1c99ead 100644 --- a/backend/src/main/java/io/metersphere/service/UserService.java +++ b/backend/src/main/java/io/metersphere/service/UserService.java @@ -318,6 +318,17 @@ public class UserService { } public void updateUser(User user) { + // todo 提取重复代码 + if (StringUtils.isNotBlank(user.getEmail())) { + UserExample example = new UserExample(); + UserExample.Criteria criteria = example.createCriteria(); + criteria.andEmailEqualTo(user.getEmail()); + criteria.andIdNotEqualTo(user.getId()); + if (userMapper.countByExample(example) > 0) { + MSException.throwException(Translator.get("user_email_already_exists")); + } + } + user.setUpdateTime(System.currentTimeMillis()); userMapper.updateByPrimaryKeySelective(user); // 禁用用户之后,剔除在线用户 From f97e20ee06dcb486897e360f73999f73360f6f57 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 23 Nov 2020 18:06:09 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix(=E6=B5=8B=E8=AF=95=E8=B7=9F=E8=B8=AA):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=94=B9=E5=8F=98=E8=80=8C=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=85=B3=E8=81=94=E7=94=A8=E4=BE=8B=E6=97=B6?= =?UTF-8?q?=E5=B7=A6=E4=BE=A7=E6=A8=A1=E5=9D=97=E6=9C=AA=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/track/plan/view/comonents/TestCaseRelevance.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue index 5d979498d4..9f7b8bfa66 100644 --- a/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue +++ b/frontend/src/business/components/track/plan/view/comonents/TestCaseRelevance.vue @@ -293,6 +293,8 @@ this.projectId = data[0].id; this.projectName = data[0].name; this.search(); + // 获取项目时刷新该项目模块 + this.getProjectNode(this.projectId) } }) } From c0b4b813f35e6f10881250e028801ddc7a662ef0 Mon Sep 17 00:00:00 2001 From: "Captain.B" Date: Mon, 23 Nov 2020 18:36:56 +0800 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E8=AE=A1=E5=88=92=E6=97=B6=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=EF=BC=8C=E6=88=90=E5=8A=9F=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E7=9B=B8=E5=90=8C=E7=9A=84=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/metersphere/track/service/TestPlanService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java index c8157e472d..ee5a113fbc 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestPlanService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestPlanService.java @@ -141,7 +141,7 @@ public class TestPlanService { } } - public List getTestPlanByName(String name) { + public synchronized List getTestPlanByName(String name) { TestPlanExample example = new TestPlanExample(); example.createCriteria().andWorkspaceIdEqualTo(SessionUtils.getCurrentWorkspaceId()) .andNameEqualTo(name); From a296de1afd9409a9279b405b6961ab05518d945b Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Mon, 23 Nov 2020 18:56:49 +0800 Subject: [PATCH 6/6] =?UTF-8?q?refactor(=E6=B5=8B=E8=AF=95=E8=B7=9F?= =?UTF-8?q?=E8=B8=AA):=20=E7=94=A8=E4=BE=8B=E8=AF=84=E5=AE=A1=E8=AF=84?= =?UTF-8?q?=E8=AE=BA=E6=8D=A2=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/track/review/commom/ReviewCommentItem.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/business/components/track/review/commom/ReviewCommentItem.vue b/frontend/src/business/components/track/review/commom/ReviewCommentItem.vue index 13b310c25e..f4ae23dd3f 100644 --- a/frontend/src/business/components/track/review/commom/ReviewCommentItem.vue +++ b/frontend/src/business/components/track/review/commom/ReviewCommentItem.vue @@ -129,6 +129,10 @@ export default { pre { margin: 0 0; + white-space: pre-wrap; + word-wrap: break-word; + width: 100%; + line-height: 20px; } .comment-delete {