Skip to content

Commit

Permalink
feat: deprecate existing hooks implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
joel authored and joel committed Feb 12, 2024
1 parent b0d9a51 commit 0820b08
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 609 deletions.
10 changes: 0 additions & 10 deletions internal/api/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,6 @@ func getExternalReferrer(ctx context.Context) string {
return obj.(string)
}

// getFunctionHooks reads the request ID from the context.
func getFunctionHooks(ctx context.Context) map[string][]string {
obj := ctx.Value(functionHooksKey)
if obj == nil {
return map[string][]string{}
}

return obj.(map[string][]string)
}

// withAdminUser adds the admin user to the context.
func withAdminUser(ctx context.Context, u *models.User) context.Context {
return context.WithValue(ctx, adminUserKey, u)
Expand Down
11 changes: 0 additions & 11 deletions internal/api/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -375,10 +375,6 @@ func (a *API) createAccountFromExternalIdentity(tx *storage.Connection, r *http.
}); terr != nil {
return nil, terr
}
if terr = triggerEventHooks(ctx, tx, SignupEvent, user, config); terr != nil {
return nil, terr
}

// fall through to auto-confirm and issue token
if terr = user.Confirm(tx); terr != nil {
return nil, internalServerError("Error updating user").WithInternalError(terr)
Expand Down Expand Up @@ -410,16 +406,12 @@ func (a *API) createAccountFromExternalIdentity(tx *storage.Connection, r *http.
}); terr != nil {
return nil, terr
}
if terr = triggerEventHooks(ctx, tx, LoginEvent, user, config); terr != nil {
return nil, terr
}
}

return user, nil
}

func (a *API) processInvite(r *http.Request, ctx context.Context, tx *storage.Connection, userData *provider.UserProvidedData, inviteToken, providerType string) (*models.User, error) {
config := a.config
user, err := models.FindUserByConfirmationToken(tx, inviteToken)
if err != nil {
if models.IsNotFoundError(err) {
Expand Down Expand Up @@ -467,9 +459,6 @@ func (a *API) processInvite(r *http.Request, ctx context.Context, tx *storage.Co
}); err != nil {
return nil, err
}
if err := triggerEventHooks(ctx, tx, SignupEvent, user, config); err != nil {
return nil, err
}

// an account with a previously unconfirmed email + password
// combination or phone may exist. so now that there is an
Expand Down
167 changes: 0 additions & 167 deletions internal/api/hook_test.go

This file was deleted.

Loading

0 comments on commit 0820b08

Please sign in to comment.