mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-14 05:27:29 -06:00
[feature] New user sign-up via web page (#2796)
* [feature] User sign-up form and admin notifs * add chosen + filtered languages to migration * remove stray comment * chosen languages schmosen schmanguages * proper error on local account missing
This commit is contained in:
parent
a483bd9e38
commit
9fb8a78f91
68 changed files with 1456 additions and 437 deletions
|
|
@ -380,3 +380,33 @@ func (i *instanceDB) GetInstanceModeratorAddresses(ctx context.Context) ([]strin
|
|||
|
||||
return addresses, nil
|
||||
}
|
||||
|
||||
func (i *instanceDB) GetInstanceModerators(ctx context.Context) ([]*gtsmodel.Account, error) {
|
||||
accountIDs := []string{}
|
||||
|
||||
// Select account IDs of approved, confirmed,
|
||||
// and enabled moderators or admins.
|
||||
|
||||
q := i.db.
|
||||
NewSelect().
|
||||
TableExpr("? AS ?", bun.Ident("users"), bun.Ident("user")).
|
||||
Column("user.account_id").
|
||||
Where("? = ?", bun.Ident("user.approved"), true).
|
||||
Where("? IS NOT NULL", bun.Ident("user.confirmed_at")).
|
||||
Where("? = ?", bun.Ident("user.disabled"), false).
|
||||
WhereGroup(" AND ", func(q *bun.SelectQuery) *bun.SelectQuery {
|
||||
return q.
|
||||
Where("? = ?", bun.Ident("user.moderator"), true).
|
||||
WhereOr("? = ?", bun.Ident("user.admin"), true)
|
||||
})
|
||||
|
||||
if err := q.Scan(ctx, &accountIDs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(accountIDs) == 0 {
|
||||
return nil, db.ErrNoEntries
|
||||
}
|
||||
|
||||
return i.state.DB.GetAccountsByIDs(ctx, accountIDs)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue