diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-04-10 16:37:02 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-04-14 12:08:11 +0200 |
commit | e50556fcc8d81dae5978bcb3e1dd5104789aab0f (patch) | |
tree | 000c94f5da8061efa360c0e580e77261de84e8b1 /app/controllers/invites_controller.rb | |
parent | 8949af0c9f2aa90b979043a0a6ee264ac0c036b9 (diff) | |
download | gitlab-ce-e50556fcc8d81dae5978bcb3e1dd5104789aab0f.tar.gz |
Let invites be declined.
Diffstat (limited to 'app/controllers/invites_controller.rb')
-rw-r--r-- | app/controllers/invites_controller.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 8b1f6eeba1b..1b236a48e90 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -1,5 +1,6 @@ class InvitesController < ApplicationController before_filter :member + skip_before_filter :authenticate_user!, only: :decline respond_to :html @@ -31,6 +32,32 @@ class InvitesController < ApplicationController end end + def decline + if member.decline_invite! + case member.source + when Project + project = member.source + source = "project #{project.name_with_namespace}" + when Group + group = member.source + source = "group #{group.name}" + else + source = "who knows what" + end + + path = + if current_user + dashboard_path + else + new_user_session_path + end + + redirect_to path, notice: "You have declined the invite to join #{source}." + else + redirect_to :back, alert: "The invite could not be declined." + end + end + private def member |