summaryrefslogtreecommitdiff
path: root/internal/processing/account/create.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/processing/account/create.go')
-rw-r--r--internal/processing/account/create.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/processing/account/create.go b/internal/processing/account/create.go
index 56557af42..a13e84a78 100644
--- a/internal/processing/account/create.go
+++ b/internal/processing/account/create.go
@@ -21,10 +21,13 @@ package account
import (
"context"
"fmt"
+
"github.com/sirupsen/logrus"
+ "github.com/superseriousbusiness/gotosocial/internal/ap"
apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
+ "github.com/superseriousbusiness/gotosocial/internal/messages"
"github.com/superseriousbusiness/gotosocial/internal/text"
"github.com/superseriousbusiness/oauth2/v4"
)
@@ -66,6 +69,23 @@ func (p *processor) Create(ctx context.Context, applicationToken oauth2.TokenInf
return nil, fmt.Errorf("error creating new access token for user %s: %s", user.ID, err)
}
+ if user.Account == nil {
+ a, err := p.db.GetAccountByID(ctx, user.AccountID)
+ if err != nil {
+ return nil, fmt.Errorf("error getting new account from the database: %s", err)
+ }
+ user.Account = a
+ }
+
+ // there are side effects for creating a new account (sending confirmation emails etc)
+ // so pass a message to the processor so that it can do it asynchronously
+ p.fromClientAPI <- messages.FromClientAPI{
+ APObjectType: ap.ObjectProfile,
+ APActivityType: ap.ActivityCreate,
+ GTSModel: user.Account,
+ OriginAccount: user.Account,
+ }
+
return &apimodel.Token{
AccessToken: accessToken.GetAccess(),
TokenType: "Bearer",