some small re-orderings to confirm query params in correct places

This commit is contained in:
kim 2025-04-25 16:57:10 +01:00
commit 93ad2850f6

View file

@ -162,12 +162,12 @@ func (t *timelineDB) GetLocalTimeline(ctx context.Context, page *paging.Page) ([
// Public only.
q = q.Where("? = ?", bun.Ident("visibility"), gtsmodel.VisibilityPublic)
// Ignore boosts.
q = q.Where("? IS NULL", bun.Ident("boost_of_id"))
// Only include statuses that aren't pending approval.
q = q.Where("? = ?", bun.Ident("pending_approval"), false)
// Ignore boosts.
q = q.Where("? IS NULL", bun.Ident("boost_of_id"))
return q, nil
},
)
@ -332,6 +332,13 @@ func loadStatusTimelinePage(
Table("statuses").
Column("id")
// Append caller
// query details.
q, err := query(q)
if err != nil {
return nil, err
}
if maxID != "" {
// Set a maximum ID boundary if was given.
q = q.Where("? < ?", bun.Ident("id"), maxID)
@ -342,13 +349,6 @@ func loadStatusTimelinePage(
q = q.Where("? > ?", bun.Ident("id"), minID)
}
// Append caller
// query details.
q, err := query(q)
if err != nil {
return nil, err
}
// Set query ordering.
if order.Ascending() {
q = q.OrderExpr("? ASC", bun.Ident("id"))