fix(用例管理): 修复用例评审更新标签失败以及页面不可以输入空格以及mock通知未隐藏问题

--bug=1036075 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001036075
--bug=1038043 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001038043
--bug=1039034 --user=郭雨琦 https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001039034
This commit is contained in:
guoyuqi 2024-04-10 21:09:35 +08:00 committed by 刘瑞斌
parent 08826e6236
commit 528f831207
9 changed files with 23 additions and 69 deletions

View File

@ -266,7 +266,7 @@ CREATE TABLE IF NOT EXISTS message_task(
`update_time` BIGINT NOT NULL COMMENT '更新时间' ,
`use_default_template` BIT NOT NULL DEFAULT 1 COMMENT '是否使用默认模版' ,
`use_default_subject` BIT NOT NULL DEFAULT 1 COMMENT '是否使用默认标题(仅邮件)' ,
`subject` VARCHAR(64) COMMENT '邮件标题' ,
`subject` VARCHAR(1000) COMMENT '邮件标题' ,
PRIMARY KEY (id)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4

View File

@ -285,6 +285,8 @@ public class CaseReviewService {
caseReview.setModuleId(request.getModuleId());
if (CollectionUtils.isNotEmpty(request.getTags())) {
caseReview.setTags(request.getTags());
} else {
caseReview.setTags(new ArrayList<>());
}
caseReview.setDescription(request.getDescription());
checkAndSetStartAndEndTime(request, caseReview);

View File

@ -26,6 +26,7 @@ import jakarta.annotation.Resource;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import java.util.*;
@ -171,6 +172,7 @@ public class FunctionalCaseCommentService {
String subject = defaultSubjectMap.get(NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK + "_" + functionalCaseCommentRequest.getEvent());
List<String> relatedUsers = getRelatedUsers(functionalCaseDTO.getRelatedUsers());
User user = userMapper.selectByPrimaryKey(userId);
setLanguage(user.getLanguage());
BeanMap beanMap = new BeanMap(functionalCaseDTO);
Map paramMap = new HashMap<>(beanMap);
paramMap.put(NoticeConstants.RelatedUser.OPERATOR, user.getName());
@ -187,6 +189,16 @@ public class FunctionalCaseCommentService {
noticeSendService.send(NoticeConstants.TaskType.FUNCTIONAL_CASE_TASK, noticeModel);
}
private static void setLanguage(String language) {
Locale locale = Locale.SIMPLIFIED_CHINESE;
if (StringUtils.containsIgnoreCase("US",language)) {
locale = Locale.US;
} else if (StringUtils.containsIgnoreCase("TW",language)){
locale = Locale.TAIWAN;
}
LocaleContextHolder.setLocale(locale);
}
/**
* 检查被回复的评论是否为空
* @param functionalCaseCommentRequest 页面参数

View File

@ -11,6 +11,7 @@ import io.metersphere.functional.request.FunctionalCaseBatchEditRequest;
import io.metersphere.functional.request.FunctionalCaseBatchRequest;
import io.metersphere.functional.request.FunctionalCaseCommentRequest;
import io.metersphere.sdk.util.BeanUtils;
import io.metersphere.sdk.util.Translator;
import io.metersphere.system.domain.CustomField;
import io.metersphere.system.domain.CustomFieldExample;
import io.metersphere.system.dto.sdk.OptionDTO;
@ -52,6 +53,7 @@ public class FunctionalCaseNoticeService {
public FunctionalCaseDTO getFunctionalCaseDTO(FunctionalCaseCommentRequest functionalCaseCommentRequest) {
FunctionalCase functionalCase = functionalCaseMapper.selectByPrimaryKey(functionalCaseCommentRequest.getCaseId());
FunctionalCaseDTO functionalCaseDTO = new FunctionalCaseDTO();
functionalCaseDTO.setTriggerMode(Translator.get("log.test_plan.functional_case"));
BeanUtils.copyBean(functionalCaseDTO, functionalCase);
setNotifier(functionalCaseCommentRequest, functionalCaseDTO);
List<OptionDTO> customFields = getCustomFields(functionalCaseCommentRequest.getCaseId());

View File

@ -1063,6 +1063,7 @@ public class FunctionalCaseService {
*/
private void noticeModule(List<FunctionalCaseDTO> noticeList, FunctionalCaseExcelData functionalCaseExcelData, FunctionalCaseImportRequest request, String userId, Map<String, TemplateCustomFieldDTO> customFieldsMap) {
FunctionalCaseDTO functionalCaseDTO = new FunctionalCaseDTO();
functionalCaseDTO.setTriggerMode(Translator.get("log.test_plan.functional_case"));
functionalCaseDTO.setName(functionalCaseExcelData.getName());
functionalCaseDTO.setProjectId(request.getProjectId());
functionalCaseDTO.setCaseEditType(functionalCaseExcelData.getCaseEditType());

View File

@ -585,72 +585,6 @@
"useDefaultSubject":true
}
]
},
{
"event":"MOCK_CREATE",
"eventName":"",
"receivers":[
{
"id": "",
"name": ""
}
],
"projectRobotConfigList":[
{
"robotId":"",
"enable":"",
"template":"",
"defaultTemplate":"",
"useDefaultTemplate":true,
"subject":"",
"defaultSubject":"",
"useDefaultSubject":true
}
]
},
{
"event":"MOCK_UPDATE",
"eventName":"",
"receivers":[
{
"id": "CREATE_USER",
"name": ""
}
],
"projectRobotConfigList":[
{
"robotId":"",
"enable":"",
"template":"",
"defaultTemplate":"",
"useDefaultTemplate":true,
"subject":"",
"defaultSubject":"",
"useDefaultSubject":true
}
]
},
{
"event":"MOCK_DELETE",
"eventName":"",
"receivers":[
{
"id": "CREATE_USER",
"name": ""
}
],
"projectRobotConfigList":[
{
"robotId":"",
"enable":"",
"template":"",
"defaultTemplate":"",
"useDefaultTemplate":true,
"subject":"",
"defaultSubject":"",
"useDefaultSubject":true
}
]
}
]
},

View File

@ -95,6 +95,9 @@ public class MailNoticeSender extends AbstractNoticeSender {
LogUtils.debug("发件人地址" + javaMailSender.getUsername());
LogUtils.debug("helper" + helper);
if (subject.length() > 60) {
subject = subject.substring(0,59);
}
helper.setSubject("MeterSphere " + subject);
LogUtils.info("收件人地址: {}", Arrays.asList(users));

View File

@ -10,7 +10,7 @@
asterisk-position="end"
>
<a-input
v-model.trim="form.name"
v-model="form.name"
:max-length="255"
:placeholder="t('system.orgTemplate.caseNamePlaceholder')"
allow-clear

View File

@ -12,7 +12,7 @@
asterisk-position="end"
>
<a-input
v-model.trim.modelValue="reviewForm.name"
v-model:modelValue="reviewForm.name"
:placeholder="t('caseManagement.caseReview.reviewNamePlaceholder')"
:max-length="255"
/>