summaryrefslogtreecommitdiff
path: root/internal/db/bundb/admin.go
diff options
context:
space:
mode:
authorLibravatar tsmethurst <tobi.smethurst@protonmail.com>2022-02-08 12:17:18 +0100
committerLibravatar tsmethurst <tobi.smethurst@protonmail.com>2022-02-08 12:17:18 +0100
commit4c294a596a9e0524f89b80e1608c3411f4fcf679 (patch)
tree23851533a5f1adb5442fd7c3c034578c34cd3f0d /internal/db/bundb/admin.go
parentupdate outdated comment (diff)
parent[chore] Drone config update (#383) (diff)
downloadgotosocial-4c294a596a9e0524f89b80e1608c3411f4fcf679.tar.xz
Merge branch 'main' into media_refactor
Diffstat (limited to 'internal/db/bundb/admin.go')
-rw-r--r--internal/db/bundb/admin.go12
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/db/bundb/admin.go b/internal/db/bundb/admin.go
index 37c0db6d3..a92834f9c 100644
--- a/internal/db/bundb/admin.go
+++ b/internal/db/bundb/admin.go
@@ -94,13 +94,13 @@ func (a *adminDB) NewSignup(ctx context.Context, username string, reason string,
// if something went wrong while creating a user, we might already have an account, so check here first...
acct := &gtsmodel.Account{}
- err = a.conn.NewSelect().
+ q := a.conn.NewSelect().
Model(acct).
Where("username = ?", username).
- WhereGroup(" AND ", whereEmptyOrNull("domain")).
- Scan(ctx)
- if err != nil {
- // we just don't have an account yet so create one
+ WhereGroup(" AND ", whereEmptyOrNull("domain"))
+
+ if err := q.Scan(ctx); err != nil {
+ // we just don't have an account yet so create one before we proceed
accountURIs := uris.GenerateURIsForAccount(username)
accountID, err := id.NewRandomULID()
if err != nil {
@@ -125,6 +125,7 @@ func (a *adminDB) NewSignup(ctx context.Context, username string, reason string,
FollowingURI: accountURIs.FollowingURI,
FeaturedCollectionURI: accountURIs.CollectionURI,
}
+
if _, err = a.conn.
NewInsert().
Model(acct).
@@ -158,6 +159,7 @@ func (a *adminDB) NewSignup(ctx context.Context, username string, reason string,
if emailVerified {
u.ConfirmedAt = time.Now()
u.Email = email
+ u.UnconfirmedEmail = ""
}
if admin {