summaryrefslogtreecommitdiff
path: root/internal/db/bundb/timeline.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-08-24 11:49:37 +0200
committerLibravatar GitHub <noreply@github.com>2024-08-24 11:49:37 +0200
commitf23f04e0b1d117be714bf91d5266dab219ed741e (patch)
tree0b3ddd60d51c8729949c3669993910a7f8f32a7b /internal/db/bundb/timeline.go
parent[performance] ffmpeg ffprobe wrapper improvements (#3225) (diff)
downloadgotosocial-f23f04e0b1d117be714bf91d5266dab219ed741e.tar.xz
[feature] Interaction requests client api + settings panel (#3215)
* [feature] Interaction requests client api + settings panel * test accept / reject * fmt * don't pin rejected interaction * use single db model for interaction accept, reject, and request * swaggor * env sharting * append errors * remove ErrNoEntries checks * change intReqID to reqID * rename "pend" to "request" * markIntsPending -> mark interactionsPending * use log instead of returning error when rejecting interaction * empty migration * jolly renaming * make interactionURI unique again * swag grr * remove unnecessary locks * invalidate as last step
Diffstat (limited to 'internal/db/bundb/timeline.go')
-rw-r--r--internal/db/bundb/timeline.go38
1 files changed, 25 insertions, 13 deletions
diff --git a/internal/db/bundb/timeline.go b/internal/db/bundb/timeline.go
index e6c7e482d..995c4e84f 100644
--- a/internal/db/bundb/timeline.go
+++ b/internal/db/bundb/timeline.go
@@ -89,19 +89,6 @@ func (t *timelineDB) GetHomeTimeline(ctx context.Context, accountID string, maxI
q = q.Where("? = ?", bun.Ident("status.local"), local)
}
- if limit > 0 {
- // limit amount of statuses returned
- q = q.Limit(limit)
- }
-
- if frontToBack {
- // Page down.
- q = q.Order("status.id DESC")
- } else {
- // Page up.
- q = q.Order("status.id ASC")
- }
-
// As this is the home timeline, it should be
// populated by statuses from accounts followed
// by accountID, and posts from accountID itself.
@@ -137,6 +124,22 @@ func (t *timelineDB) GetHomeTimeline(ctx context.Context, accountID string, maxI
bun.In(targetAccountIDs),
)
+ // Only include statuses that aren't pending approval.
+ q = q.Where("NOT ? = ?", bun.Ident("status.pending_approval"), true)
+
+ if limit > 0 {
+ // limit amount of statuses returned
+ q = q.Limit(limit)
+ }
+
+ if frontToBack {
+ // Page down.
+ q = q.Order("status.id DESC")
+ } else {
+ // Page up.
+ q = q.Order("status.id ASC")
+ }
+
if err := q.Scan(ctx, &statusIDs); err != nil {
return nil, err
}
@@ -213,6 +216,9 @@ func (t *timelineDB) GetPublicTimeline(ctx context.Context, maxID string, sinceI
q = q.Where("? = ?", bun.Ident("status.local"), local)
}
+ // Only include statuses that aren't pending approval.
+ q = q.Where("NOT ? = ?", bun.Ident("status.pending_approval"), true)
+
if limit > 0 {
// limit amount of statuses returned
q = q.Limit(limit)
@@ -395,6 +401,9 @@ func (t *timelineDB) GetListTimeline(
frontToBack = false
}
+ // Only include statuses that aren't pending approval.
+ q = q.Where("NOT ? = ?", bun.Ident("status.pending_approval"), true)
+
if limit > 0 {
// limit amount of statuses returned
q = q.Limit(limit)
@@ -491,6 +500,9 @@ func (t *timelineDB) GetTagTimeline(
frontToBack = false
}
+ // Only include statuses that aren't pending approval.
+ q = q.Where("NOT ? = ?", bun.Ident("status.pending_approval"), true)
+
if limit > 0 {
// limit amount of statuses returned
q = q.Limit(limit)