mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-01 16:12:45 +00:00
some more little fixes for all to enjoy (#161)
This commit is contained in:
parent
2162f21636
commit
30f688dbe2
|
@ -217,10 +217,6 @@ func (a *accountDB) GetAccountStatuses(ctx context.Context, accountID string, li
|
||||||
q = q.Limit(limit)
|
q = q.Limit(limit)
|
||||||
}
|
}
|
||||||
|
|
||||||
if excludeReplies {
|
|
||||||
q = q.WhereGroup(" AND ", whereEmptyOrNull("in_reply_to_id"))
|
|
||||||
}
|
|
||||||
|
|
||||||
if pinnedOnly {
|
if pinnedOnly {
|
||||||
q = q.Where("pinned = ?", true)
|
q = q.Where("pinned = ?", true)
|
||||||
}
|
}
|
||||||
|
@ -237,6 +233,10 @@ func (a *accountDB) GetAccountStatuses(ctx context.Context, accountID string, li
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if excludeReplies {
|
||||||
|
q = q.WhereGroup(" AND ", whereEmptyOrNull("in_reply_to_id"))
|
||||||
|
}
|
||||||
|
|
||||||
if err := q.Scan(ctx); err != nil {
|
if err := q.Scan(ctx); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,9 @@ type instanceDB struct {
|
||||||
func (i *instanceDB) CountInstanceUsers(ctx context.Context, domain string) (int, db.Error) {
|
func (i *instanceDB) CountInstanceUsers(ctx context.Context, domain string) (int, db.Error) {
|
||||||
q := i.conn.
|
q := i.conn.
|
||||||
NewSelect().
|
NewSelect().
|
||||||
Model(&[]*gtsmodel.Account{})
|
Model(&[]*gtsmodel.Account{}).
|
||||||
|
Where("username != ?", domain).
|
||||||
|
Where("? IS NULL", bun.Ident("suspended_at"))
|
||||||
|
|
||||||
if domain == i.config.Host {
|
if domain == i.config.Host {
|
||||||
// if the domain is *this* domain, just count where the domain field is null
|
// if the domain is *this* domain, just count where the domain field is null
|
||||||
|
@ -46,11 +48,6 @@ func (i *instanceDB) CountInstanceUsers(ctx context.Context, domain string) (int
|
||||||
q = q.Where("domain = ?", domain)
|
q = q.Where("domain = ?", domain)
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't count the instance account or suspended users
|
|
||||||
q = q.
|
|
||||||
Where("username != ?", domain).
|
|
||||||
Where("? IS NULL", bun.Ident("suspended_at"))
|
|
||||||
|
|
||||||
count, err := q.Count(ctx)
|
count, err := q.Count(ctx)
|
||||||
|
|
||||||
return count, processErrorResponse(err)
|
return count, processErrorResponse(err)
|
||||||
|
|
|
@ -237,7 +237,7 @@ func (r *relationshipDB) AcceptFollowRequest(ctx context.Context, originAccountI
|
||||||
if _, err := r.conn.
|
if _, err := r.conn.
|
||||||
NewInsert().
|
NewInsert().
|
||||||
Model(follow).
|
Model(follow).
|
||||||
On("CONFLICT CONSTRAINT follows_account_id_target_account_id_key DO UPDATE set uri = ?", follow.URI).
|
On("CONFLICT ON CONSTRAINT follows_account_id_target_account_id_key DO UPDATE set uri = ?", follow.URI).
|
||||||
Exec(ctx); err != nil {
|
Exec(ctx); err != nil {
|
||||||
return nil, processErrorResponse(err)
|
return nil, processErrorResponse(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue