Avoid unread counter to be off by one
This commit is contained in:
parent
702256bcc0
commit
46d67acf22
1 changed files with 7 additions and 6 deletions
13
ui/entry.go
13
ui/entry.go
|
@ -266,12 +266,6 @@ func (c *Controller) ShowUnreadEntry(ctx *handler.Context, request *handler.Requ
|
|||
return
|
||||
}
|
||||
|
||||
args, err := c.getCommonTemplateArgs(ctx)
|
||||
if err != nil {
|
||||
response.HTML().ServerError(err)
|
||||
return
|
||||
}
|
||||
|
||||
builder = c.store.NewEntryQueryBuilder(user.ID)
|
||||
builder.WithStatus(model.EntryStatusUnread)
|
||||
|
||||
|
@ -301,6 +295,13 @@ func (c *Controller) ShowUnreadEntry(ctx *handler.Context, request *handler.Requ
|
|||
}
|
||||
}
|
||||
|
||||
// The unread counter have to be fetched after changing the entry status
|
||||
args, err := c.getCommonTemplateArgs(ctx)
|
||||
if err != nil {
|
||||
response.HTML().ServerError(err)
|
||||
return
|
||||
}
|
||||
|
||||
response.HTML().Render("entry", args.Merge(tplParams{
|
||||
"entry": entry,
|
||||
"prevEntry": prevEntry,
|
||||
|
|
Loading…
Reference in a new issue