aboutsummaryrefslogtreecommitdiffhomepage
path: root/ui/entry_bookmark.go
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2018-11-11 11:28:29 -0800
committerGravatar Frédéric Guillot <fred@miniflux.net>2018-11-11 11:29:12 -0800
commit5a69a61d4841a35d7ddcb761a688db8c688314d6 (patch)
treeb807ee1da5b0705e7649f70742d8198f351c1224 /ui/entry_bookmark.go
parent0925899cee9362cf09e982487bd480e2b09041f4 (diff)
Move UI middlewares and routes to ui package
Diffstat (limited to 'ui/entry_bookmark.go')
-rw-r--r--ui/entry_bookmark.go25
1 files changed, 12 insertions, 13 deletions
diff --git a/ui/entry_bookmark.go b/ui/entry_bookmark.go
index 895c2bc..a07859d 100644
--- a/ui/entry_bookmark.go
+++ b/ui/entry_bookmark.go
@@ -16,16 +16,15 @@ import (
"miniflux.app/ui/view"
)
-// ShowStarredEntry shows a single feed entry in "starred" mode.
-func (c *Controller) ShowStarredEntry(w http.ResponseWriter, r *http.Request) {
- user, err := c.store.UserByID(request.UserID(r))
+func (h *handler) showStarredEntryPage(w http.ResponseWriter, r *http.Request) {
+ user, err := h.store.UserByID(request.UserID(r))
if err != nil {
html.ServerError(w, r, err)
return
}
entryID := request.RouteInt64Param(r, "entryID")
- builder := c.store.NewEntryQueryBuilder(user.ID)
+ builder := h.store.NewEntryQueryBuilder(user.ID)
builder.WithEntryID(entryID)
builder.WithoutStatus(model.EntryStatusRemoved)
@@ -41,7 +40,7 @@ func (c *Controller) ShowStarredEntry(w http.ResponseWriter, r *http.Request) {
}
if entry.Status == model.EntryStatusUnread {
- err = c.store.SetEntriesStatus(user.ID, []int64{entry.ID}, model.EntryStatusRead)
+ err = h.store.SetEntriesStatus(user.ID, []int64{entry.ID}, model.EntryStatusRead)
if err != nil {
html.ServerError(w, r, err)
return
@@ -50,7 +49,7 @@ func (c *Controller) ShowStarredEntry(w http.ResponseWriter, r *http.Request) {
entry.Status = model.EntryStatusRead
}
- entryPaginationBuilder := storage.NewEntryPaginationBuilder(c.store, user.ID, entry.ID, user.EntryDirection)
+ entryPaginationBuilder := storage.NewEntryPaginationBuilder(h.store, user.ID, entry.ID, user.EntryDirection)
entryPaginationBuilder.WithStarred()
prevEntry, nextEntry, err := entryPaginationBuilder.Entries()
if err != nil {
@@ -60,16 +59,16 @@ func (c *Controller) ShowStarredEntry(w http.ResponseWriter, r *http.Request) {
nextEntryRoute := ""
if nextEntry != nil {
- nextEntryRoute = route.Path(c.router, "starredEntry", "entryID", nextEntry.ID)
+ nextEntryRoute = route.Path(h.router, "starredEntry", "entryID", nextEntry.ID)
}
prevEntryRoute := ""
if prevEntry != nil {
- prevEntryRoute = route.Path(c.router, "starredEntry", "entryID", prevEntry.ID)
+ prevEntryRoute = route.Path(h.router, "starredEntry", "entryID", prevEntry.ID)
}
- sess := session.New(c.store, request.SessionID(r))
- view := view.New(c.tpl, r, sess)
+ sess := session.New(h.store, request.SessionID(r))
+ view := view.New(h.tpl, r, sess)
view.Set("entry", entry)
view.Set("prevEntry", prevEntry)
view.Set("nextEntry", nextEntry)
@@ -77,9 +76,9 @@ func (c *Controller) ShowStarredEntry(w http.ResponseWriter, r *http.Request) {
view.Set("prevEntryRoute", prevEntryRoute)
view.Set("menu", "starred")
view.Set("user", user)
- view.Set("countUnread", c.store.CountUnreadEntries(user.ID))
- view.Set("countErrorFeeds", c.store.CountErrorFeeds(user.ID))
- view.Set("hasSaveEntry", c.store.HasSaveEntry(user.ID))
+ view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
+ view.Set("countErrorFeeds", h.store.CountErrorFeeds(user.ID))
+ view.Set("hasSaveEntry", h.store.HasSaveEntry(user.ID))
html.OK(w, r, view.Render("entry"))
}