From e5790b3231e9b799de424960d50d0420fac3aa54 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Sun, 14 Jul 2019 10:29:41 +0800 Subject: [PATCH] Complete CommentTagDirective. --- .../halo/app/model/freemarker/tag/CommentTagDirective.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/run/halo/app/model/freemarker/tag/CommentTagDirective.java b/src/main/java/run/halo/app/model/freemarker/tag/CommentTagDirective.java index 9b01c571b..62e8df8ac 100644 --- a/src/main/java/run/halo/app/model/freemarker/tag/CommentTagDirective.java +++ b/src/main/java/run/halo/app/model/freemarker/tag/CommentTagDirective.java @@ -2,7 +2,10 @@ package run.halo.app.model.freemarker.tag; import freemarker.core.Environment; import freemarker.template.*; +import org.springframework.data.domain.Page; import org.springframework.stereotype.Component; +import run.halo.app.model.entity.PostComment; +import run.halo.app.model.enums.CommentStatus; import run.halo.app.model.support.HaloConst; import run.halo.app.service.PostCommentService; @@ -34,7 +37,8 @@ public class CommentTagDirective implements TemplateDirectiveModel { switch (method) { case "latest": int top = Integer.parseInt(params.get("top").toString()); - env.setVariable("comments", builder.build().wrap(postCommentService.pageLatest(top))); + Page postComments = postCommentService.pageLatest(top, CommentStatus.PUBLISHED); + env.setVariable("comments", builder.build().wrap(postCommentService.convertToWithPostVo(postComments))); break; case "count": env.setVariable("count", builder.build().wrap(postCommentService.count()));