From b3bf853409d952ee4dbbac181e2451d2f6b08baa Mon Sep 17 00:00:00 2001 From: Booklordofthedings Date: Thu, 21 Nov 2024 00:56:50 +0100 Subject: [PATCH] [bugfix] post counters should not include direct messages #3504 The fix is relativly simple, it just adds a line to the relevant function which excludes all private posts. --- internal/db/bundb/instance.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/db/bundb/instance.go b/internal/db/bundb/instance.go index 419951253..12d38cfe1 100644 --- a/internal/db/bundb/instance.go +++ b/internal/db/bundb/instance.go @@ -103,7 +103,11 @@ func (i *instanceDB) CountInstanceStatuses(ctx context.Context, domain string) ( // Ignore statuses that are currently pending approval. q = q.Where("NOT ? = ?", bun.Ident("status.pending_approval"), true) + // Ignore statuses that are direct messages. + q = q.Where("NOT ? = ?", bun.Ident("status.visibility"), "direct") + count, err := q.Count(ctx) + if err != nil { return 0, err }