Commit 12e969be authored by Liang Ding's avatar Liang Ding

🎨 #12690

parent c14b3955
...@@ -193,7 +193,7 @@ public class CommentMgmtService { ...@@ -193,7 +193,7 @@ public class CommentMgmtService {
String commentName = requestJSONObject.getString(Comment.COMMENT_NAME); String commentName = requestJSONObject.getString(Comment.COMMENT_NAME);
if (MAX_COMMENT_NAME_LENGTH < commentName.length() || MIN_COMMENT_NAME_LENGTH > commentName.length()) { if (MAX_COMMENT_NAME_LENGTH < commentName.length() || MIN_COMMENT_NAME_LENGTH > commentName.length()) {
LOGGER.log(Level.WARN, "Comment name is too long[{0}]", commentName); LOGGER.log(Level.WARN, "Comment name is too long [{0}]", commentName);
ret.put(Keys.MSG, langPropsService.get("nameTooLongLabel")); ret.put(Keys.MSG, langPropsService.get("nameTooLongLabel"));
return ret; return ret;
...@@ -201,7 +201,8 @@ public class CommentMgmtService { ...@@ -201,7 +201,8 @@ public class CommentMgmtService {
final JSONObject commenter = userRepository.getByUserName(commentName); final JSONObject commenter = userRepository.getByUserName(commentName);
if (null == commenter) { if (null == commenter) {
ret.put(Keys.MSG, langPropsService.get("nameTooLongLabel")); LOGGER.log(Level.WARN, "Not found user [" + commentName + "]");
ret.put(Keys.MSG, langPropsService.get("queryUserFailedLabel"));
return ret; return ret;
} }
...@@ -209,7 +210,7 @@ public class CommentMgmtService { ...@@ -209,7 +210,7 @@ public class CommentMgmtService {
final String commentURL = requestJSONObject.optString(Comment.COMMENT_URL); final String commentURL = requestJSONObject.optString(Comment.COMMENT_URL);
if (!Strings.isURL(commentURL) || StringUtils.contains(commentURL, "<")) { if (!Strings.isURL(commentURL) || StringUtils.contains(commentURL, "<")) {
LOGGER.log(Level.WARN, "Comment URL is invalid[{0}]", commentURL); LOGGER.log(Level.WARN, "Comment URL is invalid [{0}]", commentURL);
ret.put(Keys.MSG, langPropsService.get("urlInvalidLabel")); ret.put(Keys.MSG, langPropsService.get("urlInvalidLabel"));
return ret; return ret;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
# Author: Dongxu Wang # Author: Dongxu Wang
# #
queryUserFailedLabel=Query user info failed
commentContentLabel=Content commentContentLabel=Content
cancelLabel=Cancel cancelLabel=Cancel
langLabel=en_US langLabel=en_US
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
# Author: Dongxu Wang # Author: Dongxu Wang
# #
queryUserFailedLabel=\u67E5\u8BE2\u7528\u6237\u4FE1\u606F\u5931\u8D25
commentContentLabel=\u8BC4\u8BBA\u5185\u5BB9 commentContentLabel=\u8BC4\u8BBA\u5185\u5BB9
cancelLabel=\u53D6\u6D88 cancelLabel=\u53D6\u6D88
langLabel=zh_CN langLabel=zh_CN
......
...@@ -74,7 +74,7 @@ public class CommentMgmtServiceTestCase extends AbstractTestCase { ...@@ -74,7 +74,7 @@ public class CommentMgmtServiceTestCase extends AbstractTestCase {
final String articleId = articles.get(0).getString(Keys.OBJECT_ID); final String articleId = articles.get(0).getString(Keys.OBJECT_ID);
requestJSONObject.put(Keys.OBJECT_ID, articleId); requestJSONObject.put(Keys.OBJECT_ID, articleId);
requestJSONObject.put(Comment.COMMENT_NAME, "comment name"); requestJSONObject.put(Comment.COMMENT_NAME, "Solo");
requestJSONObject.put(Comment.COMMENT_URL, "comment URL"); requestJSONObject.put(Comment.COMMENT_URL, "comment URL");
requestJSONObject.put(Comment.COMMENT_CONTENT, "comment content"); requestJSONObject.put(Comment.COMMENT_CONTENT, "comment content");
......
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