diff options
author | 2023-08-07 19:38:11 +0200 | |
---|---|---|
committer | 2023-08-07 18:38:11 +0100 | |
commit | be3718f6e4c7bb229f9eb78b44c52d14399977cc (patch) | |
tree | a0efc132fbfb806227cc4b9af8bac9f5a5775c1c /internal/db/bundb/admin.go | |
parent | [chore]: Bump github.com/tdewolff/minify/v2 from 2.12.7 to 2.12.8 (#2073) (diff) | |
download | gotosocial-be3718f6e4c7bb229f9eb78b44c52d14399977cc.tar.xz |
[chore] Use generic pointer function (#2080)
This replaces the different $TypePtr functions with a generic
implementation.
Diffstat (limited to 'internal/db/bundb/admin.go')
-rw-r--r-- | internal/db/bundb/admin.go | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/internal/db/bundb/admin.go b/internal/db/bundb/admin.go index fb1fb9d6c..723648a9e 100644 --- a/internal/db/bundb/admin.go +++ b/internal/db/bundb/admin.go @@ -36,6 +36,7 @@ import ( "github.com/superseriousbusiness/gotosocial/internal/log" "github.com/superseriousbusiness/gotosocial/internal/state" "github.com/superseriousbusiness/gotosocial/internal/uris" + "github.com/superseriousbusiness/gotosocial/internal/util" "github.com/uptrace/bun" "golang.org/x/crypto/bcrypt" ) @@ -198,17 +199,15 @@ func (a *adminDB) NewSignup(ctx context.Context, newSignup gtsmodel.NewSignup) ( user.Email = newSignup.Email } - trueBool := func() *bool { t := true; return &t } - if newSignup.Admin { // Make new user mod + admin. - user.Moderator = trueBool() - user.Admin = trueBool() + user.Moderator = util.Ptr(true) + user.Admin = util.Ptr(true) } if newSignup.PreApproved { // Mark new user as approved. - user.Approved = trueBool() + user.Approved = util.Ptr(true) } // Insert the user! |