mirror of
https://github.com/miniflux/v2.git
synced 2025-09-15 18:57:04 +00:00
Make sure we always get the pagination in unread mode
This commit is contained in:
parent
0b0f4751fa
commit
77947282e4
4 changed files with 19 additions and 15 deletions
|
@ -49,6 +49,16 @@ func (c *Controller) ShowUnreadEntry(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
// Make sure we always get the pagination in unread mode even if the page is refreshed.
|
||||
if entry.Status == model.EntryStatusRead {
|
||||
err = c.store.SetEntriesStatus(user.ID, []int64{entry.ID}, model.EntryStatusUnread)
|
||||
if err != nil {
|
||||
logger.Error("[Controller:ShowUnreadEntry] %v", err)
|
||||
html.ServerError(w, nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
entryPaginationBuilder := storage.NewEntryPaginationBuilder(c.store, user.ID, entry.ID, user.EntryDirection)
|
||||
entryPaginationBuilder.WithStatus(model.EntryStatusUnread)
|
||||
prevEntry, nextEntry, err := entryPaginationBuilder.Entries()
|
||||
|
@ -86,8 +96,10 @@ func (c *Controller) ShowUnreadEntry(w http.ResponseWriter, r *http.Request) {
|
|||
view.Set("prevEntryRoute", prevEntryRoute)
|
||||
view.Set("menu", "unread")
|
||||
view.Set("user", user)
|
||||
view.Set("countUnread", c.store.CountUnreadEntries(user.ID))
|
||||
view.Set("hasSaveEntry", c.store.HasSaveEntry(user.ID))
|
||||
|
||||
// Fetching the counter here avoid to be off by one.
|
||||
view.Set("countUnread", c.store.CountUnreadEntries(user.ID))
|
||||
|
||||
html.OK(w, view.Render("entry"))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue