1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-06-27 16:36:00 +00:00

Improve Context to be more idiomatic

This commit is contained in:
Frédéric Guillot 2017-11-21 18:37:08 -08:00
parent 02ff7b4bcf
commit 1bc43ec2bc
17 changed files with 107 additions and 106 deletions

View file

@ -11,7 +11,7 @@ import (
// ShowHistoryPage renders the page with all read entries.
func (c *Controller) ShowHistoryPage(ctx *core.Context, request *core.Request, response *core.Response) {
user := ctx.GetLoggedUser()
user := ctx.LoggedUser()
offset := request.QueryIntegerParam("offset", 0)
args, err := c.getCommonTemplateArgs(ctx)
@ -42,14 +42,14 @@ func (c *Controller) ShowHistoryPage(ctx *core.Context, request *core.Request, r
response.HTML().Render("history", args.Merge(tplParams{
"entries": entries,
"total": count,
"pagination": c.getPagination(ctx.GetRoute("history"), count, offset),
"pagination": c.getPagination(ctx.Route("history"), count, offset),
"menu": "history",
}))
}
// FlushHistory changes all "read" items to "removed".
func (c *Controller) FlushHistory(ctx *core.Context, request *core.Request, response *core.Response) {
user := ctx.GetLoggedUser()
user := ctx.LoggedUser()
err := c.store.FlushHistory(user.ID)
if err != nil {
@ -57,5 +57,5 @@ func (c *Controller) FlushHistory(ctx *core.Context, request *core.Request, resp
return
}
response.Redirect(ctx.GetRoute("history"))
response.Redirect(ctx.Route("history"))
}