From b5e0030f8d76f981859d9c46fed68653a6ad7189 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 20 Jul 2021 10:31:29 +0200 Subject: [PATCH] auth: fix user type on database insert --- auth/middleware.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/auth/middleware.go b/auth/middleware.go index 99b8c5e168230c71a58ed690cfa2534ea0c6626e..89a25ed129b4679a888e528c32b7d1f5d893f4c4 100644 --- a/auth/middleware.go +++ b/auth/middleware.go @@ -354,6 +354,8 @@ func FetchMetaProfile(ctx context.Context, username string, user *AuthContext) e profile := result.Data.Me return database.WithTx(ctx, nil, func(tx *sql.Tx) error { + // TODO: Make the database representation consistent with this + ut := strings.ToLower(profile.UserType) row := tx.QueryRowContext(ctx, ` INSERT INTO "user" ( created, @@ -383,7 +385,7 @@ func FetchMetaProfile(ctx context.Context, username string, user *AuthContext) e location, bio, suspension_notice;`, - &profile.Username, &profile.Email, &profile.UserType, &profile.URL, + &profile.Username, &profile.Email, &ut, &profile.URL, &profile.Location, &profile.Bio, &profile.SuspensionNotice) // TODO: Register webhooks