Skip to content

Commit

Permalink
Fix metric tracking to not blow up when signup fails
Browse files Browse the repository at this point in the history
  • Loading branch information
nid90 committed Oct 10, 2023
1 parent 7e78e55 commit 9f251b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/controllers/authentication/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ class Authentication::RegistrationsController < Devise::RegistrationsController
before_action :configure_permitted_parameters, if: :devise_controller?
before_action :set_invite_token, only: [:new, :create]
before_action :set_invite, only: [:new, :create]
after_action :identify_team, only: [:create]
alias_method :user, :resource
helper_method :user

Expand Down Expand Up @@ -40,6 +39,7 @@ def create
end

finish_sign_up
identify_team
end

protected
Expand Down Expand Up @@ -96,10 +96,11 @@ def sign_up_params_for_invites
end

def sign_up_email
sign_up_params[:email]
sign_up_params[:email].downcase
end

def identify_team
SiteAnalytics.identify_and_group(user.reload, user.reload.organizations.first)
return unless user.persisted?
SiteAnalytics.identify_and_group(user, user.organizations.first)
end
end
1 change: 1 addition & 0 deletions app/models/accounts/invite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Accounts::Invite < ApplicationRecord
message: :invalid_format
}

before_save -> { self.email = email.downcase }
before_save :add_recipient
before_create :generate_token

Expand Down

0 comments on commit 9f251b1

Please sign in to comment.