mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 04:17:23 +00:00
Improve comments
This commit is contained in:
@@ -231,6 +231,7 @@ export const i18nData = {
|
||||
"Commented on": "Commented on",
|
||||
"Write down your comment": "Write down your comment",
|
||||
"Click to view more": "Click to view more",
|
||||
"Comment Details": "Comment Details",
|
||||
},
|
||||
},
|
||||
"zh-CN": {
|
||||
@@ -454,6 +455,7 @@ export const i18nData = {
|
||||
"Commented on": "评论于",
|
||||
"Write down your comment": "写下您的评论",
|
||||
"Click to view more": "点击查看更多",
|
||||
"Comment Details": "评论详情",
|
||||
},
|
||||
},
|
||||
"zh-TW": {
|
||||
@@ -677,6 +679,7 @@ export const i18nData = {
|
||||
"Commented on": "評論於",
|
||||
"Write down your comment": "寫下您的評論",
|
||||
"Click to view more": "點擊查看更多",
|
||||
"Comment Details": "評論詳情",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@@ -90,7 +90,7 @@ func serveIndexHtml(c fiber.Ctx) error {
|
||||
username := strings.TrimPrefix(path, "/user/")
|
||||
u, err := service.GetUserByUsername(username)
|
||||
if err == nil {
|
||||
preview = fmt.Sprintf("/avatar/%d", u.ID)
|
||||
preview = fmt.Sprintf("%s/avatar/%d", serverBaseURL, u.ID)
|
||||
title = u.Username
|
||||
description = "User " + u.Username + "'s profile"
|
||||
}
|
||||
@@ -105,6 +105,17 @@ func serveIndexHtml(c fiber.Ctx) error {
|
||||
description = utils.ArticleToDescription(t.Description, 256)
|
||||
}
|
||||
}
|
||||
} else if strings.HasPrefix(path, "/comments/") {
|
||||
commentIDStr := strings.TrimPrefix(path, "/comments/")
|
||||
commentID, err := strconv.Atoi(commentIDStr)
|
||||
if err == nil {
|
||||
cmt, err := service.GetCommentByID(uint(commentID))
|
||||
if err == nil {
|
||||
title = "Comment Details"
|
||||
description = utils.ArticleToDescription(cmt.Content, 200)
|
||||
preview = fmt.Sprintf("%s/avatar/%d", serverBaseURL, cmt.User.ID)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
content = strings.ReplaceAll(content, "{{SiteName}}", siteName)
|
||||
|
Reference in New Issue
Block a user