category_remove_feed.go 780 B

12345678910111213141516171819202122232425262728
  1. // SPDX-FileCopyrightText: Copyright The Miniflux Authors. All rights reserved.
  2. // SPDX-License-Identifier: Apache-2.0
  3. package ui // import "miniflux.app/v2/internal/ui"
  4. import (
  5. "net/http"
  6. "miniflux.app/v2/internal/http/request"
  7. "miniflux.app/v2/internal/http/response"
  8. )
  9. func (h *handler) removeCategoryFeed(w http.ResponseWriter, r *http.Request) {
  10. feedID := request.RouteInt64Param(r, "feedID")
  11. categoryID := request.RouteInt64Param(r, "categoryID")
  12. if !h.store.CategoryFeedExists(request.UserID(r), categoryID, feedID) {
  13. response.HTMLNotFound(w, r)
  14. return
  15. }
  16. if err := h.store.RemoveFeed(request.UserID(r), feedID); err != nil {
  17. response.HTMLServerError(w, r, err)
  18. return
  19. }
  20. response.HTMLRedirect(w, r, h.routePath("/category/%d/feeds", categoryID))
  21. }