Commit 09e78f8d authored by Liang Ding's avatar Liang Ding

#12246

parent 848a0417
...@@ -269,7 +269,18 @@ public class CommentProcessor { ...@@ -269,7 +269,18 @@ public class CommentProcessor {
try { try {
final JSONObject addResult = commentMgmtService.addArticleComment(requestJSONObject); final JSONObject addResult = commentMgmtService.addArticleComment(requestJSONObject);
final Map<String, Object> dataModel = new HashMap<>();
dataModel.put(Comment.COMMENT, addResult);
final String skinDirName = (String) httpServletRequest.getAttribute(Keys.TEMAPLTE_DIR_NAME);
final Template template = Templates.MAIN_CFG.getTemplate("common-comment.ftl");
final StringWriter stringWriter = new StringWriter();
template.process(dataModel, stringWriter);
stringWriter.close();
addResult.put("cmtTpl", stringWriter.toString());
addResult.put(Keys.STATUS_CODE, true); addResult.put(Keys.STATUS_CODE, true);
renderer.setJSONObject(addResult); renderer.setJSONObject(addResult);
} catch (final Exception e) { } catch (final Exception e) {
......
...@@ -57,7 +57,7 @@ import org.jsoup.safety.Whitelist; ...@@ -57,7 +57,7 @@ import org.jsoup.safety.Whitelist;
* Comment management service. * Comment management service.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.3.2.8, May 10, 2016 * @version 1.3.2.9, Feb 17, 2017
* @since 0.3.5 * @since 0.3.5
*/ */
@Service @Service
...@@ -399,7 +399,8 @@ public class CommentMgmtService { ...@@ -399,7 +399,8 @@ public class CommentMgmtService {
* "commentThumbnailURL": "", * "commentThumbnailURL": "",
* "commentSharpURL": "", * "commentSharpURL": "",
* "commentContent": "", // processed XSS HTML * "commentContent": "", // processed XSS HTML
* "commentName": "" // processed XSS * "commentName": "", // processed XSS
* "commentURL": "" // optional
* } * }
* </pre> * </pre>
* *
...@@ -462,6 +463,7 @@ public class CommentMgmtService { ...@@ -462,6 +463,7 @@ public class CommentMgmtService {
ret.put(Comment.COMMENT_NAME, commentName); ret.put(Comment.COMMENT_NAME, commentName);
ret.put(Comment.COMMENT_CONTENT, commentContent); ret.put(Comment.COMMENT_CONTENT, commentContent);
ret.put(Comment.COMMENT_URL, commentURL);
ret.put(Comment.COMMENT_SHARP_URL, commentSharpURL); ret.put(Comment.COMMENT_SHARP_URL, commentSharpURL);
comment.put(Comment.COMMENT_SHARP_URL, commentSharpURL); comment.put(Comment.COMMENT_SHARP_URL, commentSharpURL);
...@@ -519,7 +521,8 @@ public class CommentMgmtService { ...@@ -519,7 +521,8 @@ public class CommentMgmtService {
* "commentThumbnailURL": "", * "commentThumbnailURL": "",
* "commentSharpURL": "", * "commentSharpURL": "",
* "commentContent": "", // processed XSS HTML * "commentContent": "", // processed XSS HTML
* "commentName": "" // processed XSS * "commentName": "", // processed XSS
* "commentURL": "" // optional
* } * }
* </pre> * </pre>
* *
...@@ -561,6 +564,7 @@ public class CommentMgmtService { ...@@ -561,6 +564,7 @@ public class CommentMgmtService {
ret.put(Comment.COMMENT_NAME, commentName); ret.put(Comment.COMMENT_NAME, commentName);
ret.put(Comment.COMMENT_CONTENT, commentContent); ret.put(Comment.COMMENT_CONTENT, commentContent);
ret.put(Comment.COMMENT_URL, commentURL);
if (!Strings.isEmptyOrNull(originalCommentId)) { if (!Strings.isEmptyOrNull(originalCommentId)) {
originalComment = commentRepository.get(originalCommentId); originalComment = commentRepository.get(originalCommentId);
......
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