Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
1c0b58a7
Commit
1c0b58a7
authored
Apr 14, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplication from InvitesController.
parent
1b5c483d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
25 deletions
+22
-25
app/controllers/invites_controller.rb
app/controllers/invites_controller.rb
+22
-25
No files found.
app/controllers/invites_controller.rb
View file @
1c0b58a7
...
@@ -12,21 +12,9 @@ class InvitesController < ApplicationController
...
@@ -12,21 +12,9 @@ class InvitesController < ApplicationController
def
accept
def
accept
if
member
.
accept_invite!
(
current_user
)
if
member
.
accept_invite!
(
current_user
)
case
member
.
source
label
,
path
=
source_info
(
member
.
source
)
when
Project
project
=
member
.
source
source
=
"project
#{
project
.
name_with_namespace
}
"
path
=
namespace_project_path
(
project
.
namespace
,
project
)
when
Group
group
=
member
.
source
source
=
"group
#{
group
.
name
}
"
path
=
group_path
(
group
)
else
source
=
"who knows what"
path
=
dashboard_path
end
redirect_to
path
,
notice:
"You have been granted
#{
member
.
human_access
}
access to
#{
source
}
."
redirect_to
path
,
notice:
"You have been granted
#{
member
.
human_access
}
access to
#{
label
}
."
else
else
redirect_to
:back
,
alert:
"The invitation could not be accepted."
redirect_to
:back
,
alert:
"The invitation could not be accepted."
end
end
...
@@ -34,16 +22,7 @@ class InvitesController < ApplicationController
...
@@ -34,16 +22,7 @@ class InvitesController < ApplicationController
def
decline
def
decline
if
member
.
decline_invite!
if
member
.
decline_invite!
case
member
.
source
label
,
_
=
source_info
(
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
=
path
=
if
current_user
if
current_user
...
@@ -81,4 +60,22 @@ class InvitesController < ApplicationController
...
@@ -81,4 +60,22 @@ class InvitesController < ApplicationController
store_location_for
:user
,
request
.
fullpath
store_location_for
:user
,
request
.
fullpath
redirect_to
new_user_session_path
,
notice:
notice
redirect_to
new_user_session_path
,
notice:
notice
end
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
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment