fix(backend): users observing post count (#8295)

* do not count users that are deleted or disbled
This commit is contained in:
Moriz Wahl 2025-04-03 18:03:53 +02:00 committed by GitHub
parent 01027e42cc
commit 130da7509b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 2 deletions

View File

@ -485,7 +485,8 @@ export default {
shoutedCount:
'<-[:SHOUTED]-(related:User) WHERE NOT related.deleted = true AND NOT related.disabled = true',
emotionsCount: '<-[related:EMOTED]-(:User)',
observingUsersCount: '<-[related:OBSERVES]-(:User) WHERE related.active = true',
observingUsersCount:
'<-[obs:OBSERVES]-(related:User) WHERE obs.active = true AND NOT related.deleted = true AND NOT related.disabled = true',
},
boolean: {
shoutedByCurrentUser:

View File

@ -192,7 +192,7 @@ type Post {
statement: "MATCH (this)<-[obs:OBSERVES]-(u:User {id: $cypherParams.currentUserId}) WHERE obs.active = true RETURN COUNT(u) >= 1"
)
observingUsersCount: Int!
@cypher(statement: "MATCH (this)<-[obs:OBSERVES]-(u:User) WHERE obs.active = true RETURN COUNT(DISTINCT u)")
@cypher(statement: "MATCH (this)<-[obs:OBSERVES]-(u:User) WHERE obs.active = true AND NOT u.deleted = true AND NOT u.disabled = true RETURN COUNT(DISTINCT u)")
}
input _PostInput {