summaryrefslogtreecommitdiff
path: root/app/controllers/invites_controller.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 01:45:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-19 01:45:44 +0000
commit85dc423f7090da0a52c73eb66faf22ddb20efff9 (patch)
tree9160f299afd8c80c038f08e1545be119f5e3f1e1 /app/controllers/invites_controller.rb
parent15c2c8c66dbe422588e5411eee7e68f1fa440bb8 (diff)
downloadgitlab-ce-85dc423f7090da0a52c73eb66faf22ddb20efff9.tar.gz
Add latest changes from gitlab-org/gitlab@13-4-stable-ee
Diffstat (limited to 'app/controllers/invites_controller.rb')
-rw-r--r--app/controllers/invites_controller.rb23
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