From ce6fa4c0fc3dabfecc6b5f817d313995ffb9b364 Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Sun, 15 Aug 2021 21:18:24 +0200 Subject: [PATCH] Fix #1208 --- storage/entry_pagination_builder.go | 9 ++++++++- ui/entry_unread.go | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/storage/entry_pagination_builder.go b/storage/entry_pagination_builder.go index ce6f7fcc..e65c09ef 100644 --- a/storage/entry_pagination_builder.go +++ b/storage/entry_pagination_builder.go @@ -60,6 +60,12 @@ func (e *EntryPaginationBuilder) WithStatus(status string) { } } +// WithGloballyVisible adds global visibility to the condition. +func (e *EntryPaginationBuilder) WithGloballyVisible() { + e.conditions = append(e.conditions, "not c.hide_globally") + e.conditions = append(e.conditions, "not f.hide_globally") +} + // Entries returns previous and next entries. func (e *EntryPaginationBuilder) Entries() (*model.Entry, *model.Entry, error) { tx, err := e.store.db.Begin() @@ -104,7 +110,8 @@ func (e *EntryPaginationBuilder) getPrevNextID(tx *sql.Tx) (prevID int64, nextID lag(e.id) over (order by e.published_at asc, e.id desc) as prev_id, lead(e.id) over (order by e.published_at asc, e.id desc) as next_id FROM entries AS e - LEFT JOIN feeds AS f ON f.id=e.feed_id + JOIN feeds AS f ON f.id=e.feed_id + JOIN categories c ON c.id = f.category_id WHERE %s ORDER BY e.published_at asc, e.id desc ) diff --git a/ui/entry_unread.go b/ui/entry_unread.go index af006ea8..457b1f62 100644 --- a/ui/entry_unread.go +++ b/ui/entry_unread.go @@ -50,6 +50,7 @@ func (h *handler) showUnreadEntryPage(w http.ResponseWriter, r *http.Request) { entryPaginationBuilder := storage.NewEntryPaginationBuilder(h.store, user.ID, entry.ID, user.EntryDirection) entryPaginationBuilder.WithStatus(model.EntryStatusUnread) + entryPaginationBuilder.WithGloballyVisible() prevEntry, nextEntry, err := entryPaginationBuilder.Entries() if err != nil { html.ServerError(w, r, err)