Fix comments
This commit is contained in:
parent
b462c10197
commit
431828e256
|
@ -81,7 +81,7 @@ func ParseAlbum(data gjson.Result) (types.Album, error) {
|
||||||
return types.Album{
|
return types.Album{
|
||||||
Id: data.Get("id").String(),
|
Id: data.Get("id").String(),
|
||||||
Title: data.Get("title").String(),
|
Title: data.Get("title").String(),
|
||||||
Privacy: data.Get("privacy").String(),
|
SharedWithCommunity: data.Get("shared_with_community").Bool(),
|
||||||
Views: data.Get("view_count").Int(),
|
Views: data.Get("view_count").Int(),
|
||||||
Upvotes: data.Get("upvote_count").Int(),
|
Upvotes: data.Get("upvote_count").Int(),
|
||||||
Downvotes: data.Get("downvote_count").Int(),
|
Downvotes: data.Get("downvote_count").Int(),
|
||||||
|
|
|
@ -22,7 +22,8 @@ func HandleGallery(c *fiber.Ctx) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
comments := []types.Comment{}
|
comments := []types.Comment{}
|
||||||
if album.Privacy != "private" {
|
println(album.SharedWithCommunity)
|
||||||
|
if album.SharedWithCommunity {
|
||||||
comments, err = api.FetchComments(c.Params("galleryID"))
|
comments, err = api.FetchComments(c.Params("galleryID"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -6,7 +6,7 @@ type Album struct {
|
||||||
Views int64
|
Views int64
|
||||||
Upvotes int64
|
Upvotes int64
|
||||||
Downvotes int64
|
Downvotes int64
|
||||||
Privacy string
|
SharedWithCommunity bool
|
||||||
CreatedAt string
|
CreatedAt string
|
||||||
UpdatedAt string
|
UpdatedAt string
|
||||||
Comments int64
|
Comments int64
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
<br>
|
<br>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|
||||||
{{#equal album.Privacy "public"}}
|
{{#if comments}}
|
||||||
<div>
|
<div>
|
||||||
<hr>
|
<hr>
|
||||||
<input id="comments__expandBtn" type="checkbox">
|
<input id="comments__expandBtn" type="checkbox">
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>
|
<hr>
|
||||||
{{/equal}}
|
{{/if}}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
{{> partials/footer }}
|
{{> partials/footer }}
|
||||||
|
|
Loading…
Reference in New Issue