mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2025-12-15 12:45:25 +00:00
added user comments
This commit is contained in:
@@ -9,21 +9,21 @@ import (
|
||||
"codeberg.org/rimgo/rimgo/utils"
|
||||
"github.com/dustin/go-humanize"
|
||||
"github.com/microcosm-cc/bluemonday"
|
||||
"github.com/patrickmn/go-cache"
|
||||
"github.com/tidwall/gjson"
|
||||
"gitlab.com/golang-commonmark/linkify"
|
||||
)
|
||||
|
||||
type Comment struct {
|
||||
Comments []Comment
|
||||
User User
|
||||
User User
|
||||
Post Submission
|
||||
Id string
|
||||
Comment string
|
||||
Upvotes int64
|
||||
Downvotes int64
|
||||
Platform string
|
||||
CreatedAt string
|
||||
RelTime string
|
||||
RelTime string
|
||||
UpdatedAt string
|
||||
DeletedAt string
|
||||
}
|
||||
@@ -55,7 +55,6 @@ func (client *Client) FetchComments(galleryID string) ([]Comment, error) {
|
||||
)
|
||||
wg.Wait()
|
||||
|
||||
client.Cache.Set(galleryID + "-comments", comments, cache.DefaultExpiration)
|
||||
return comments, nil
|
||||
}
|
||||
|
||||
@@ -130,13 +129,14 @@ func parseComment(data gjson.Result) Comment {
|
||||
Username: data.Get("account.username").String(),
|
||||
Avatar: userAvatar,
|
||||
},
|
||||
Post: parseSubmission(data.Get("post")),
|
||||
Id: data.Get("id").String(),
|
||||
Comment: comment,
|
||||
Upvotes: data.Get("upvote_count").Int(),
|
||||
Downvotes: data.Get("downvote_count").Int(),
|
||||
Platform: data.Get("platform").String(),
|
||||
CreatedAt: createdAt,
|
||||
RelTime: humanize.Time(createdTime),
|
||||
RelTime: humanize.Time(createdTime),
|
||||
UpdatedAt: updatedAt,
|
||||
DeletedAt: deletedAt,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user