Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/invites_controller.rb')
-rw-r--r--app/controllers/invites_controller.rb83
1 files changed, 0 insertions, 83 deletions
diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb
deleted file mode 100644
index 1f97ff16c55..00000000000
--- a/app/controllers/invites_controller.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-class InvitesController < ApplicationController
- before_filter :member
- skip_before_filter :authenticate_user!, only: :decline
-
- respond_to :html
-
- layout 'navless'
-
- def show
-
- end
-
- def accept
- if member.accept_invite!(current_user)
- label, path = source_info(member.source)
-
- redirect_to path, notice: "You have been granted #{member.human_access} access to #{label}."
- else
- redirect_to :back, alert: "The invitation could not be accepted."
- end
- end
-
- def decline
- if member.decline_invite!
- label, _ = source_info(member.source)
-
- path =
- if current_user
- dashboard_path
- else
- new_user_session_path
- end
-
- redirect_to path, notice: "You have declined the invitation to join #{label}."
- else
- redirect_to :back, alert: "The invitation could not be declined."
- end
- end
-
- private
-
- def member
- return @member if defined?(@member)
-
- @token = params[:id]
- @member = Member.find_by_invite_token(@token)
-
- unless @member
- render_404 and return
- end
-
- @member
- end
-
- def authenticate_user!
- return if current_user
-
- notice = "To accept this invitation, sign in"
- notice << " or create an account" if current_application_settings.signup_enabled?
- notice << "."
-
- store_location_for :user, request.fullpath
- redirect_to new_user_session_path, notice: notice
- end
-
- def source_info(source)
- case source
- when Project
- project = member.source
- label = "project #{project.name_with_namespace}"
- path = namespace_project_path(project.namespace, project)
- when Group
- group = member.source
- label = "group #{group.name}"
- path = group_path(group)
- else
- label = "who knows what"
- path = dashboard_path
- end
-
- [label, path]
- end
-end