fix(测试跟踪): 测试计划自动更新功能用例状态失效

--bug=1017289 --user=陈建星 【测试跟踪】github]#17894,测试计划勾选“自动更新状态”后,执行接口用例/场景报错 https://www.tapd.cn/55049933/s/1287519
This commit is contained in:
chenjianxing 2022-11-03 15:26:21 +08:00 committed by jianxing
parent f1cfccaab5
commit 956cd90c3e
1 changed files with 3 additions and 1 deletions

View File

@ -7,6 +7,7 @@ import io.metersphere.base.mapper.TestCaseMapper;
import io.metersphere.base.mapper.UserMapper;
import io.metersphere.base.mapper.ext.ExtTestCaseCommentMapper;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.i18n.Translator;
import io.metersphere.log.utils.ReflexObjectUtil;
@ -39,7 +40,8 @@ public class TestCaseCommentService {
public TestCaseComment saveComment(SaveCommentRequest request) {
TestCaseComment testCaseComment = new TestCaseComment();
testCaseComment.setId(request.getId());
testCaseComment.setAuthor(SessionUtils.getUser().getId());
SessionUser user = SessionUtils.getUser();
testCaseComment.setAuthor(user == null ? "System" : user.getId());
testCaseComment.setCaseId(request.getCaseId());
testCaseComment.setCreateTime(System.currentTimeMillis());
testCaseComment.setUpdateTime(System.currentTimeMillis());