[chore] Use generic pointer function (#2080)

This replaces the different $TypePtr functions with a generic
implementation.
This commit is contained in:
Daenney
2023-08-07 19:38:11 +02:00
committed by GitHub
parent 517829ae6a
commit be3718f6e4
22 changed files with 393 additions and 391 deletions

View File

@@ -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!