Commit d689fe5b by lepdou

bugfix: branch modify master's item should ignore some field

parent c06d5eee
......@@ -52,6 +52,8 @@ public class ItemController {
toCreate.setLineNum(0);
toCreate.setId(0);
toCreate.setDataChangeLastModifiedBy(toCreate.getDataChangeCreatedBy());
toCreate.setDataChangeLastModifiedTime(null);
toCreate.setDataChangeCreatedTime(null);
ItemDTO createdItem = itemService.createItem(appId, Env.fromString(env),
clusterName, namespaceName, toCreate);
......
......@@ -58,6 +58,15 @@ public class ItemController {
@RequestBody ItemDTO item) {
checkModel(isValidItem(item));
//protect
item.setLineNum(0);
item.setId(0);
String userId = userInfoHolder.getUser().getUserId();
item.setDataChangeCreatedBy(userId);
item.setDataChangeLastModifiedBy(userId);
item.setDataChangeCreatedTime(null);
item.setDataChangeLastModifiedTime(null);
return configService.createItem(appId, Env.valueOf(env), clusterName, namespaceName, item);
}
......
......@@ -91,12 +91,6 @@ public class ItemService {
}
item.setNamespaceId(namespace.getId());
if (StringUtils.isEmpty(item.getDataChangeCreatedBy())) {
String username = userInfoHolder.getUser().getUserId();
item.setDataChangeCreatedBy(username);
item.setDataChangeLastModifiedBy(username);
}
ItemDTO itemDTO = itemAPI.createItem(appId, env, clusterName, namespaceName, item);
Cat.logEvent(CatEventType.MODIFY_NAMESPACE, String.format("%s+%s+%s+%s", appId, env, clusterName, namespaceName));
return itemDTO;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment