From f23f04e0b1d117be714bf91d5266dab219ed741e Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sat, 24 Aug 2024 11:49:37 +0200 Subject: [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 --- internal/db/bundb/timeline.go | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) (limited to 'internal/db/bundb/timeline.go') 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) -- cgit v1.2.3