@@ -106,14 +106,11 @@ public String getPaginatedPosts(
106106 public String getPostById (@ PathVariable long id , Model model , Principal principal ) {
107107
108108 Optional <Post > postOptional = postRepository .findById (id );
109-
110109 if (postOptional .isPresent ()) {
111110 model .addAttribute ("post" , postOptional .get ());
112111 model .addAttribute ("comment" , new CreateComment ());
113112 // load comment
114- // TODO : double check whether should do below here or in CommentController
115113 List <Comment > commentList = commentService .getCommentsByPostId (id );
116- System .out .println (">>> comment len = " + commentList .size ());
117114 // only add to model when comment size > 0
118115 if (commentList .size () > 0 ){
119116 model .addAttribute ("comments" , commentList );
@@ -163,7 +160,6 @@ public String createPost(CreatePost request, Model model, Principal principal){
163160 post .setSynopsis (PostUtil .getSynopsis (request .getContent ()));
164161 post .setAuthorId (author .getId ());
165162 post .setDateTime (LocalDateTime .now ());
166- //post.setAuthorId(authorId);
167163 log .info (">>> request = " + request + " post = " + post + " author = " + author );
168164 log .info (">>>> create post end ..." );
169165 postService .savePost (post );
@@ -179,7 +175,6 @@ public String getMyPost(
179175 Model model ) {
180176
181177 Author author = authorService .getByName (principal .getName ());
182-
183178 // if there is current user has no any post
184179 if (author == null ){
185180 model .addAttribute ("user" , principal .getName ());
0 commit comments