Always mark the entry as read after fetching the pagination in unread mode

This commit is contained in:
Frédéric Guillot 2018-06-30 17:35:06 -07:00
parent 4c7fce0233
commit 240f801755

View file

@ -77,15 +77,13 @@ func (c *Controller) ShowUnreadEntry(w http.ResponseWriter, r *http.Request) {
prevEntryRoute = route.Path(c.router, "unreadEntry", "entryID", prevEntry.ID) prevEntryRoute = route.Path(c.router, "unreadEntry", "entryID", prevEntry.ID)
} }
// We change the status here, otherwise we cannot get the pagination for unread items. // Always mark the entry as read after fetching the pagination.
if entry.Status == model.EntryStatusUnread {
err = c.store.SetEntriesStatus(user.ID, []int64{entry.ID}, model.EntryStatusRead) err = c.store.SetEntriesStatus(user.ID, []int64{entry.ID}, model.EntryStatusRead)
if err != nil { if err != nil {
logger.Error("[Controller:ShowUnreadEntry] %v", err) logger.Error("[Controller:ShowUnreadEntry] %v", err)
html.ServerError(w, nil) html.ServerError(w, nil)
return return
} }
}
sess := session.New(c.store, ctx) sess := session.New(c.store, ctx)
view := view.New(c.tpl, ctx, sess) view := view.New(c.tpl, ctx, sess)