diff --git a/api/album.go b/api/album.go
index 56a98cb..2635b05 100644
--- a/api/album.go
+++ b/api/album.go
@@ -32,7 +32,7 @@ func FetchAlbum(albumID string) (types.Album, error) {
} else {
album, err = FetchPosts(albumID)
}
-
+
return album, err
}
@@ -48,7 +48,7 @@ func FetchPosts(albumID string) (types.Album, error) {
}
data := gjson.Parse(string(body))
-
+
return ParseAlbum(data)
}
@@ -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
-}
\ No newline at end of file
+}
diff --git a/pages/gallery.go b/pages/gallery.go
index 83557c3..aef2609 100644
--- a/pages/gallery.go
+++ b/pages/gallery.go
@@ -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
diff --git a/types/Album.go b/types/Album.go
index daeb181..b85e8b8 100644
--- a/types/Album.go
+++ b/types/Album.go
@@ -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
}
diff --git a/views/gallery.hbs b/views/gallery.hbs
index ee0a4d4..98544c7 100644
--- a/views/gallery.hbs
+++ b/views/gallery.hbs
@@ -69,7 +69,7 @@
{{/each}}
- {{#equal album.Privacy "public"}}
+ {{#if comments}}