Skip to content

Commit

Permalink
🐛 社区同步评论
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed Feb 12, 2019
1 parent cf259b7 commit 2c00c8f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions controller/commentctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ import (
"bytes"
"html/template"
"net/http"
"path/filepath"
"strconv"
"strings"

"github.com/b3log/pipe/model"
"github.com/b3log/pipe/service"
"github.com/b3log/pipe/util"
"github.com/gin-gonic/gin"
"path/filepath"
)

func getRepliesAction(c *gin.Context) {
Expand Down Expand Up @@ -125,12 +125,16 @@ func addCommentAction(c *gin.Context) {
if 0 != comment.ParentCommentID {
parentCommentModel := service.Comment.GetComment(comment.ParentCommentID)
if nil != parentCommentModel {
parentCommentAuthorModel := service.User.GetUser(parentCommentModel.AuthorID)
parentCommentAuthorName := parentCommentModel.AuthorName
if "" == parentCommentAuthorName {
parentCommentAuthorModel := service.User.GetUser(parentCommentModel.AuthorID)
parentCommentAuthorName = parentCommentAuthorModel.Name
}
parentComment := &model.ThemeComment{
ID: parentCommentModel.ID,
URL: getBlogURL(c) + article.Path + "?p=" + strconv.Itoa(page) + "#pipeComment" + strconv.Itoa(int(parentCommentModel.ID)),
Author: &model.ThemeAuthor{
Name: parentCommentAuthorModel.Name,
Name: parentCommentAuthorName,
},
}
themeComment.Parent = parentComment
Expand Down

0 comments on commit 2c00c8f

Please sign in to comment.