diff options
author | Frédéric Guillot <fred@miniflux.net> | 2018-11-11 11:28:29 -0800 |
---|---|---|
committer | Frédéric Guillot <fred@miniflux.net> | 2018-11-11 11:29:12 -0800 |
commit | 5a69a61d4841a35d7ddcb761a688db8c688314d6 (patch) | |
tree | b807ee1da5b0705e7649f70742d8198f351c1224 /ui/subscription_choose.go | |
parent | 0925899cee9362cf09e982487bd480e2b09041f4 (diff) |
Move UI middlewares and routes to ui package
Diffstat (limited to 'ui/subscription_choose.go')
-rw-r--r-- | ui/subscription_choose.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/ui/subscription_choose.go b/ui/subscription_choose.go index 4f701c8..b554b03 100644 --- a/ui/subscription_choose.go +++ b/ui/subscription_choose.go @@ -16,18 +16,17 @@ import ( "miniflux.app/ui/view" ) -// ChooseSubscription shows a page to choose a subscription. -func (c *Controller) ChooseSubscription(w http.ResponseWriter, r *http.Request) { - sess := session.New(c.store, request.SessionID(r)) - view := view.New(c.tpl, r, sess) +func (h *handler) showChooseSubscriptionPage(w http.ResponseWriter, r *http.Request) { + sess := session.New(h.store, request.SessionID(r)) + view := view.New(h.tpl, r, sess) - user, err := c.store.UserByID(request.UserID(r)) + user, err := h.store.UserByID(request.UserID(r)) if err != nil { html.ServerError(w, r, err) return } - categories, err := c.store.Categories(user.ID) + categories, err := h.store.Categories(user.ID) if err != nil { html.ServerError(w, r, err) return @@ -36,8 +35,8 @@ func (c *Controller) ChooseSubscription(w http.ResponseWriter, r *http.Request) view.Set("categories", categories) view.Set("menu", "feeds") view.Set("user", user) - view.Set("countUnread", c.store.CountUnreadEntries(user.ID)) - view.Set("countErrorFeeds", c.store.CountErrorFeeds(user.ID)) + view.Set("countUnread", h.store.CountUnreadEntries(user.ID)) + view.Set("countErrorFeeds", h.store.CountErrorFeeds(user.ID)) view.Set("defaultUserAgent", client.DefaultUserAgent) subscriptionForm := form.NewSubscriptionForm(r) @@ -48,7 +47,7 @@ func (c *Controller) ChooseSubscription(w http.ResponseWriter, r *http.Request) return } - feed, err := c.feedHandler.CreateFeed( + feed, err := h.feedHandler.CreateFeed( user.ID, subscriptionForm.CategoryID, subscriptionForm.URL, @@ -64,5 +63,5 @@ func (c *Controller) ChooseSubscription(w http.ResponseWriter, r *http.Request) return } - html.Redirect(w, r, route.Path(c.router, "feedEntries", "feedID", feed.ID)) + html.Redirect(w, r, route.Path(h.router, "feedEntries", "feedID", feed.ID)) } |