history_flush.go 691 B

12345678910111213141516171819202122232425
  1. // Copyright 2018 Frédéric Guillot. All rights reserved.
  2. // Use of this source code is governed by the Apache 2.0
  3. // license that can be found in the LICENSE file.
  4. package ui
  5. import (
  6. "net/http"
  7. "github.com/miniflux/miniflux/http/context"
  8. "github.com/miniflux/miniflux/http/response"
  9. "github.com/miniflux/miniflux/http/response/html"
  10. "github.com/miniflux/miniflux/http/route"
  11. )
  12. // FlushHistory changes all "read" items to "removed".
  13. func (c *Controller) FlushHistory(w http.ResponseWriter, r *http.Request) {
  14. err := c.store.FlushHistory(context.New(r).UserID())
  15. if err != nil {
  16. html.ServerError(w, err)
  17. return
  18. }
  19. response.Redirect(w, r, route.Path(c.router, "history"))
  20. }