diff options
author | 2024-11-21 10:06:06 +0000 | |
---|---|---|
committer | 2024-11-21 11:06:06 +0100 | |
commit | 9ace025da1c51bf6b2f21ebc5d7dce2f7171906b (patch) | |
tree | e6ade361fa3e59ed020c70e33833198fa124bae3 /internal/db | |
parent | [docs] Include link to a live instance in README (#3549) (diff) | |
download | gotosocial-9ace025da1c51bf6b2f21ebc5d7dce2f7171906b.tar.xz |
[bugfix] post counters should not include direct messages (#3554)
* [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.
* Formating fix
* mb
Diffstat (limited to 'internal/db')
-rw-r--r-- | internal/db/bundb/instance.go | 3 | ||||
-rw-r--r-- | internal/db/bundb/instance_test.go | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/internal/db/bundb/instance.go b/internal/db/bundb/instance.go index 419951253..bbfd82ffb 100644 --- a/internal/db/bundb/instance.go +++ b/internal/db/bundb/instance.go @@ -103,6 +103,9 @@ 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 diff --git a/internal/db/bundb/instance_test.go b/internal/db/bundb/instance_test.go index 13fd7f61c..4b8ec9962 100644 --- a/internal/db/bundb/instance_test.go +++ b/internal/db/bundb/instance_test.go @@ -47,7 +47,7 @@ func (suite *InstanceTestSuite) TestCountInstanceUsersRemote() { func (suite *InstanceTestSuite) TestCountInstanceStatuses() { count, err := suite.db.CountInstanceStatuses(context.Background(), config.GetHost()) suite.NoError(err) - suite.Equal(20, count) + suite.Equal(19, count) } func (suite *InstanceTestSuite) TestCountInstanceStatusesRemote() { |