diff options
author | 2018-01-02 22:04:48 -0800 | |
---|---|---|
committer | 2018-01-02 22:04:48 -0800 | |
commit | 320d1b016747ba4501da9417d9ce5f99368a5768 (patch) | |
tree | 1054d96afde6022951b76cc4a09b78e1e3f05058 /server/ui/controller/unread.go | |
parent | c39f2e1a8d2de6d412bcc673d29eb0f7a2d1f5f7 (diff) | |
download | v2-320d1b016747ba4501da9417d9ce5f99368a5768.tar.gz v2-320d1b016747ba4501da9417d9ce5f99368a5768.tar.zst v2-320d1b016747ba4501da9417d9ce5f99368a5768.zip |
Refactor packages to have more idiomatic code base
Diffstat (limited to 'server/ui/controller/unread.go')
-rw-r--r-- | server/ui/controller/unread.go | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/server/ui/controller/unread.go b/server/ui/controller/unread.go deleted file mode 100644 index 1dd7b072..00000000 --- a/server/ui/controller/unread.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2017 Frédéric Guillot. All rights reserved. -// Use of this source code is governed by the Apache 2.0 -// license that can be found in the LICENSE file. - -package controller - -import ( - "github.com/miniflux/miniflux/model" - "github.com/miniflux/miniflux/server/core" -) - -// ShowUnreadPage render the page with all unread entries. -func (c *Controller) ShowUnreadPage(ctx *core.Context, request *core.Request, response *core.Response) { - user := ctx.LoggedUser() - offset := request.QueryIntegerParam("offset", 0) - - builder := c.store.NewEntryQueryBuilder(user.ID) - builder.WithStatus(model.EntryStatusUnread) - countUnread, err := builder.CountEntries() - if err != nil { - response.HTML().ServerError(err) - return - } - - if offset >= countUnread { - offset = 0 - } - - builder = c.store.NewEntryQueryBuilder(user.ID) - builder.WithStatus(model.EntryStatusUnread) - builder.WithOrder(model.DefaultSortingOrder) - builder.WithDirection(user.EntryDirection) - builder.WithOffset(offset) - builder.WithLimit(nbItemsPerPage) - entries, err := builder.GetEntries() - if err != nil { - response.HTML().ServerError(err) - return - } - - response.HTML().Render("unread", tplParams{ - "user": user, - "countUnread": countUnread, - "entries": entries, - "pagination": c.getPagination(ctx.Route("unread"), countUnread, offset), - "menu": "unread", - "csrf": ctx.CSRF(), - }) -} |