mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-05 01:38:08 -06:00
some more little fixes for all to enjoy (#161)
This commit is contained in:
parent
2162f21636
commit
30f688dbe2
3 changed files with 13 additions and 16 deletions
|
|
@ -37,20 +37,17 @@ type instanceDB struct {
|
|||
func (i *instanceDB) CountInstanceUsers(ctx context.Context, domain string) (int, db.Error) {
|
||||
q := i.conn.
|
||||
NewSelect().
|
||||
Model(&[]*gtsmodel.Account{})
|
||||
|
||||
if domain == i.config.Host {
|
||||
// if the domain is *this* domain, just count where the domain field is null
|
||||
q = q.WhereGroup(" AND ", whereEmptyOrNull("domain"))
|
||||
} else {
|
||||
q = q.Where("domain = ?", domain)
|
||||
}
|
||||
|
||||
// don't count the instance account or suspended users
|
||||
q = q.
|
||||
Model(&[]*gtsmodel.Account{}).
|
||||
Where("username != ?", domain).
|
||||
Where("? IS NULL", bun.Ident("suspended_at"))
|
||||
|
||||
if domain == i.config.Host {
|
||||
// if the domain is *this* domain, just count where the domain field is null
|
||||
q = q.WhereGroup(" AND ", whereEmptyOrNull("domain"))
|
||||
} else {
|
||||
q = q.Where("domain = ?", domain)
|
||||
}
|
||||
|
||||
count, err := q.Count(ctx)
|
||||
|
||||
return count, processErrorResponse(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue