diff options
Diffstat (limited to 'app/controllers/invites_controller.rb')
-rw-r--r-- | app/controllers/invites_controller.rb | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 29cafbbbdb6..aa9c7d01ba3 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -12,11 +12,13 @@ class InvitesController < ApplicationController respond_to :html def show + track_experiment('opened') accept if skip_invitation_prompt? end def accept if member.accept_invite!(current_user) + track_experiment('accepted') redirect_to invite_details[:path], notice: _("You have been granted %{member_human_access} access to %{title} %{name}.") % { member_human_access: member.human_access, title: invite_details[:title], name: invite_details[:name] } else @@ -74,8 +76,14 @@ class InvitesController < ApplicationController notice << "or create an account" if Gitlab::CurrentSettings.allow_signup? notice = notice.join(' ') + "." + # this is temporary finder instead of using member method due to render_404 possibility + # will be resolved via https://gitlab.com/gitlab-org/gitlab/-/issues/245325 + initial_member = Member.find_by_invite_token(params[:id]) + redirect_params = initial_member ? { invite_email: initial_member.invite_email } : {} + store_location_for :user, request.fullpath - redirect_to new_user_session_path(invite_email: member.invite_email), notice: notice + + redirect_to new_user_session_path(redirect_params), notice: notice end def invite_details @@ -96,4 +104,17 @@ class InvitesController < ApplicationController } end end + + def track_experiment(action) + return unless params[:new_user_invite] + + property = params[:new_user_invite] == 'experiment' ? 'experiment_group' : 'control_group' + + Gitlab::Tracking.event( + Gitlab::Experimentation::EXPERIMENTS[:invite_email][:tracking_category], + action, + property: property, + label: Digest::MD5.hexdigest(member.to_global_id.to_s) + ) + end end |