From ac3693562b635aaab4f43ad5d1343aae7ba5b7d2 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Wed, 17 Jul 2019 21:29:00 -0700 Subject: Ask for confirmation before flushing history --- ui/history_flush.go | 7 +++---- ui/ui.go | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'ui') diff --git a/ui/history_flush.go b/ui/history_flush.go index d0b8f62..e74c5b9 100644 --- a/ui/history_flush.go +++ b/ui/history_flush.go @@ -8,16 +8,15 @@ import ( "net/http" "miniflux.app/http/request" - "miniflux.app/http/response/html" - "miniflux.app/http/route" + "miniflux.app/http/response/json" ) func (h *handler) flushHistory(w http.ResponseWriter, r *http.Request) { err := h.store.FlushHistory(request.UserID(r)) if err != nil { - html.ServerError(w, r, err) + json.ServerError(w, r, err) return } - html.Redirect(w, r, route.Path(h.router, "history")) + json.OK(w, r, "OK") } diff --git a/ui/ui.go b/ui/ui.go index 47383d2..b71abb2 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -45,7 +45,7 @@ func Serve(router *mux.Router, store *storage.Storage, pool *worker.Pool, feedHa // History pages. uiRouter.HandleFunc("/history", handler.showHistoryPage).Name("history").Methods("GET") uiRouter.HandleFunc("/history/entry/{entryID}", handler.showReadEntryPage).Name("readEntry").Methods("GET") - uiRouter.HandleFunc("/history/flush", handler.flushHistory).Name("flushHistory").Methods("GET") + uiRouter.HandleFunc("/history/flush", handler.flushHistory).Name("flushHistory").Methods("POST") // Bookmark pages. uiRouter.HandleFunc("/starred", handler.showStarredPage).Name("starred").Methods("GET") -- cgit v1.2.3