mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-30 05:46:15 -06:00
add processCreateAccountFromClientAPI
This commit is contained in:
parent
0fee68f5fe
commit
a558cb1dda
1 changed files with 24 additions and 0 deletions
|
|
@ -36,6 +36,9 @@ func (p *processor) ProcessFromClientAPI(ctx context.Context, clientMsg messages
|
|||
case ap.ActivityCreate:
|
||||
// CREATE
|
||||
switch clientMsg.APObjectType {
|
||||
case ap.ObjectProfile, ap.ActorPerson:
|
||||
// CREATE ACCOUNT/PROFILE
|
||||
return p.processCreateAccountFromClientAPI(ctx, clientMsg)
|
||||
case ap.ObjectNote:
|
||||
// CREATE NOTE
|
||||
return p.processCreateStatusFromClientAPI(ctx, clientMsg)
|
||||
|
|
@ -103,6 +106,27 @@ func (p *processor) ProcessFromClientAPI(ctx context.Context, clientMsg messages
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *processor) processCreateAccountFromClientAPI(ctx context.Context, clientMsg messages.FromClientAPI) error {
|
||||
account, ok := clientMsg.GTSModel.(*gtsmodel.Account)
|
||||
if !ok {
|
||||
return errors.New("account was not parseable as *gtsmodel.Account")
|
||||
}
|
||||
|
||||
// return if the account isn't from this domain
|
||||
if account.Domain != "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
// get the user this account belongs to
|
||||
user := >smodel.User{}
|
||||
if err := p.db.GetWhere(ctx, []db.Where{{Key: "account_id", Value: account.ID}}, user); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// email a confirmation to this user
|
||||
return p.userProcessor.SendConfirmEmail(ctx, user, account.Username)
|
||||
}
|
||||
|
||||
func (p *processor) processCreateStatusFromClientAPI(ctx context.Context, clientMsg messages.FromClientAPI) error {
|
||||
status, ok := clientMsg.GTSModel.(*gtsmodel.Status)
|
||||
if !ok {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue