Fix comments

This commit is contained in:
video-prize-ranch 2022-01-23 20:59:29 -05:00
parent b462c10197
commit 431828e256
No known key found for this signature in database
GPG Key ID: D8EAA4C5B12A7281
4 changed files with 26 additions and 25 deletions

View File

@ -79,14 +79,14 @@ func ParseAlbum(data gjson.Result) (types.Album, error) {
}
return types.Album{
Id: data.Get("id").String(),
Title: data.Get("title").String(),
Privacy: data.Get("privacy").String(),
Views: data.Get("view_count").Int(),
Upvotes: data.Get("upvote_count").Int(),
Downvotes: data.Get("downvote_count").Int(),
Comments: data.Get("comment_count").Int(),
CreatedAt: createdAt,
Media: media,
Id: data.Get("id").String(),
Title: data.Get("title").String(),
SharedWithCommunity: data.Get("shared_with_community").Bool(),
Views: data.Get("view_count").Int(),
Upvotes: data.Get("upvote_count").Int(),
Downvotes: data.Get("downvote_count").Int(),
Comments: data.Get("comment_count").Int(),
CreatedAt: createdAt,
Media: media,
}, nil
}

View File

@ -22,7 +22,8 @@ func HandleGallery(c *fiber.Ctx) error {
}
comments := []types.Comment{}
if album.Privacy != "private" {
println(album.SharedWithCommunity)
if album.SharedWithCommunity {
comments, err = api.FetchComments(c.Params("galleryID"))
if err != nil {
return err

View File

@ -1,14 +1,14 @@
package types
type Album struct {
Id string
Title string
Views int64
Upvotes int64
Downvotes int64
Privacy string
CreatedAt string
UpdatedAt string
Comments int64
Media []Media
Id string
Title string
Views int64
Upvotes int64
Downvotes int64
SharedWithCommunity bool
CreatedAt string
UpdatedAt string
Comments int64
Media []Media
}

View File

@ -69,7 +69,7 @@
<br>
{{/each}}
{{#equal album.Privacy "public"}}
{{#if comments}}
<div>
<hr>
<input id="comments__expandBtn" type="checkbox">
@ -84,7 +84,7 @@
</div>
</div>
<hr>
{{/equal}}
{{/if}}
</main>
{{> partials/footer }}