diff options
author | Frédéric Guillot <fred@miniflux.net> | 2017-11-21 15:46:59 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2017-11-21 15:46:59 -0800 |
commit | 549a4277b0c000d7cf0b2867c895599d283d70a1 (patch) | |
tree | 1b4c982e8a2c6205cb646b11c4d1e6d11ecfbab0 /server/ui/controller/history.go | |
parent | 238b9e4c8594b8846b3cd9a24702a2299581a0a1 (diff) |
Add flush history feature
Diffstat (limited to 'server/ui/controller/history.go')
-rw-r--r-- | server/ui/controller/history.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/server/ui/controller/history.go b/server/ui/controller/history.go index 2c06737..e4612e1 100644 --- a/server/ui/controller/history.go +++ b/server/ui/controller/history.go @@ -9,6 +9,7 @@ import ( "github.com/miniflux/miniflux2/server/core" ) +// ShowHistoryPage renders the page with all read entries. func (c *Controller) ShowHistoryPage(ctx *core.Context, request *core.Request, response *core.Response) { user := ctx.GetLoggedUser() offset := request.GetQueryIntegerParam("offset", 0) @@ -45,3 +46,16 @@ func (c *Controller) ShowHistoryPage(ctx *core.Context, request *core.Request, r "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() + + err := c.store.FlushHistory(user.ID) + if err != nil { + response.Html().ServerError(err) + return + } + + response.Redirect(ctx.GetRoute("history")) +} |