aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <f@miniflux.net> 2024-08-17 17:42:34 -0700
committerGravatar Frédéric Guillot <f@miniflux.net> 2024-08-17 18:08:01 -0700
commitf3a5a3ee14f4e9b0658f0ef5e050ba2bc872bc5a (patch)
treea423e0ec8216d43ae4b197d87c75f920d8b1c789
parente98e16e45a1e1ef6159c068b0a9c43eb8551dcac (diff)
downloadv2-f3a5a3ee14f4e9b0658f0ef5e050ba2bc872bc5a.tar.gz
v2-f3a5a3ee14f4e9b0658f0ef5e050ba2bc872bc5a.tar.zst
v2-f3a5a3ee14f4e9b0658f0ef5e050ba2bc872bc5a.zip
fix(fever): correct sorting direction when using max_id argument
-rw-r--r--internal/fever/handler.go2
-rw-r--r--internal/storage/entry_query_builder.go6
2 files changed, 4 insertions, 4 deletions
diff --git a/internal/fever/handler.go b/internal/fever/handler.go
index 45455cf4..ef1c39c7 100644
--- a/internal/fever/handler.go
+++ b/internal/fever/handler.go
@@ -247,7 +247,6 @@ func (h *handler) handleItems(w http.ResponseWriter, r *http.Request) {
builder := h.store.NewEntryQueryBuilder(userID)
builder.WithoutStatus(model.EntryStatusRemoved)
builder.WithLimit(50)
- builder.WithSorting("id", model.DefaultSortingDirection)
switch {
case request.HasQueryParam(r, "since_id"):
@@ -258,6 +257,7 @@ func (h *handler) handleItems(w http.ResponseWriter, r *http.Request) {
slog.Int64("since_id", sinceID),
)
builder.AfterEntryID(sinceID)
+ builder.WithSorting("id", "ASC")
}
case request.HasQueryParam(r, "max_id"):
maxID := request.QueryInt64Param(r, "max_id", 0)
diff --git a/internal/storage/entry_query_builder.go b/internal/storage/entry_query_builder.go
index 6bc475fc..1245e1d4 100644
--- a/internal/storage/entry_query_builder.go
+++ b/internal/storage/entry_query_builder.go
@@ -402,13 +402,13 @@ func (e *EntryQueryBuilder) GetEntryIDs() ([]int64, error) {
query := `
SELECT
e.id
- FROM
+ FROM
entries e
LEFT JOIN
feeds f
ON
- f.id=e.feed_id
- WHERE
+ f.id=e.feed_id
+ WHERE
%s %s
`