unread_mark_all_read.go 682 B

1234567891011121314151617181920212223
  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/route"
  10. "github.com/miniflux/miniflux/logger"
  11. )
  12. // MarkAllAsRead marks all unread entries as read.
  13. func (c *Controller) MarkAllAsRead(w http.ResponseWriter, r *http.Request) {
  14. if err := c.store.MarkAllAsRead(context.New(r).UserID()); err != nil {
  15. logger.Error("[MarkAllAsRead] %v", err)
  16. }
  17. response.Redirect(w, r, route.Path(c.router, "unread"))
  18. }