diff --git a/collections.go b/collections.go index 7eb3741..adf89d4 100644 --- a/collections.go +++ b/collections.go @@ -783,11 +783,7 @@ func handleViewCollection(app *App, w http.ResponseWriter, r *http.Request) erro // Add more data // TODO: fix this mess of collections inside collections - if isOwner { - displayPage.PinnedPosts, _ = app.db.GetPinnedPosts(coll.CollectionObj, true) - } else { - displayPage.PinnedPosts, _ = app.db.GetPinnedPosts(coll.CollectionObj, false) - } + displayPage.PinnedPosts, _ = app.db.GetPinnedPosts(coll.CollectionObj, isOwner) err = templates["collection"].ExecuteTemplate(w, "collection", displayPage) if err != nil { @@ -884,11 +880,7 @@ func handleViewCollectionTag(app *App, w http.ResponseWriter, r *http.Request) e coll.Owner = displayPage.Owner // Add more data // TODO: fix this mess of collections inside collections - if isOwner { - displayPage.PinnedPosts, _ = app.db.GetPinnedPosts(coll.CollectionObj, true) - } else { - displayPage.PinnedPosts, _ = app.db.GetPinnedPosts(coll.CollectionObj, false) - } + displayPage.PinnedPosts, _ = app.db.GetPinnedPosts(coll.CollectionObj, isOwner) err = templates["collection-tags"].ExecuteTemplate(w, "collection-tags", displayPage) if err != nil { diff --git a/posts.go b/posts.go index edef6fb..a1383fa 100644 --- a/posts.go +++ b/posts.go @@ -1380,11 +1380,7 @@ Are you sure it was ever here?`, IsCustomDomain: cr.isCustomDomain, IsFound: postFound, } - if p.IsOwner { - tp.PinnedPosts, _ = app.db.GetPinnedPosts(coll, true) - } else { - tp.PinnedPosts, _ = app.db.GetPinnedPosts(coll, false) - } + tp.PinnedPosts, _ = app.db.GetPinnedPosts(coll, p.IsOwner) tp.IsPinned = len(*tp.PinnedPosts) > 0 && PostsContains(tp.PinnedPosts, p) if !postFound {