feed_remove.go 699 B

1234567891011121314151617181920212223242526272829
  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 // import "miniflux.app/ui"
  5. import (
  6. "net/http"
  7. "miniflux.app/http/request"
  8. "miniflux.app/http/response/html"
  9. "miniflux.app/http/route"
  10. )
  11. func (h *handler) removeFeed(w http.ResponseWriter, r *http.Request) {
  12. feedID := request.RouteInt64Param(r, "feedID")
  13. if !h.store.FeedExists(request.UserID(r), feedID) {
  14. html.NotFound(w, r)
  15. return
  16. }
  17. if err := h.store.RemoveFeed(request.UserID(r), feedID); err != nil {
  18. html.ServerError(w, r, err)
  19. return
  20. }
  21. html.Redirect(w, r, route.Path(h.router, "feeds"))
  22. }