diff options
author | 2017-12-04 20:40:23 -0800 | |
---|---|---|
committer | 2017-12-04 20:40:23 -0800 | |
commit | 0e6fc2db1ec04d82154517202a5cc1339dcce250 (patch) | |
tree | 06f3c0b9ca60c11684506b6617475535b3db4969 /server/ui/controller/entry.go | |
parent | 5546dd99a5d9d677187037a22f4b1ae43d2c6c21 (diff) | |
download | v2-0e6fc2db1ec04d82154517202a5cc1339dcce250.tar.gz v2-0e6fc2db1ec04d82154517202a5cc1339dcce250.tar.zst v2-0e6fc2db1ec04d82154517202a5cc1339dcce250.zip |
Improve naviguation
Diffstat (limited to 'server/ui/controller/entry.go')
-rw-r--r-- | server/ui/controller/entry.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/server/ui/controller/entry.go b/server/ui/controller/entry.go index 933f0c63..309fa09e 100644 --- a/server/ui/controller/entry.go +++ b/server/ui/controller/entry.go @@ -191,15 +191,6 @@ func (c *Controller) ShowUnreadEntry(ctx *core.Context, request *core.Request, r return } - if entry.Status == model.EntryStatusUnread { - err = c.store.SetEntriesStatus(user.ID, []int64{entry.ID}, model.EntryStatusRead) - if err != nil { - log.Println(err) - response.HTML().ServerError(nil) - return - } - } - args, err := c.getCommonTemplateArgs(ctx) if err != nil { response.HTML().ServerError(err) @@ -225,6 +216,16 @@ func (c *Controller) ShowUnreadEntry(ctx *core.Context, request *core.Request, r prevEntryRoute = ctx.Route("unreadEntry", "entryID", prevEntry.ID) } + // We change the status here, otherwise we cannot get the pagination for unread items. + if entry.Status == model.EntryStatusUnread { + err = c.store.SetEntriesStatus(user.ID, []int64{entry.ID}, model.EntryStatusRead) + if err != nil { + log.Println(err) + response.HTML().ServerError(nil) + return + } + } + response.HTML().Render("entry", args.Merge(tplParams{ "entry": entry, "prevEntry": prevEntry, |