mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-03 10:08:26 -05:00
Backport #22509 Co-authored-by: Sybren <122987084+drsybren@users.noreply.github.com>
This commit is contained in:
parent
e902b98cc2
commit
e6e2c2f4a4
1 changed files with 4 additions and 1 deletions
|
@ -1227,7 +1227,10 @@ func GetUserByOpenID(uri string) (*User, error) {
|
||||||
// GetAdminUser returns the first administrator
|
// GetAdminUser returns the first administrator
|
||||||
func GetAdminUser() (*User, error) {
|
func GetAdminUser() (*User, error) {
|
||||||
var admin User
|
var admin User
|
||||||
has, err := db.GetEngine(db.DefaultContext).Where("is_admin=?", true).Get(&admin)
|
has, err := db.GetEngine(db.DefaultContext).
|
||||||
|
Where("is_admin=?", true).
|
||||||
|
Asc("id"). // Reliably get the admin with the lowest ID.
|
||||||
|
Get(&admin)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
|
|
Loading…
Reference in a new issue