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
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0c8a27f8
Commit
0c8a27f8
authored
Jun 11, 2021
by
Doug Stull
Committed by
Tetiana Chupryna
Jun 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take more declarative approach with membership actions
- clearer code and less re-branching.
parent
fc686e6c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
27 deletions
+27
-27
app/controllers/concerns/membership_actions.rb
app/controllers/concerns/membership_actions.rb
+3
-27
app/controllers/groups/group_members_controller.rb
app/controllers/groups/group_members_controller.rb
+12
-0
app/controllers/projects/project_members_controller.rb
app/controllers/projects/project_members_controller.rb
+12
-0
No files found.
app/controllers/concerns/membership_actions.rb
View file @
0c8a27f8
...
...
@@ -140,39 +140,15 @@ module MembershipActions
end
def
root_params_key
case
membershipable
when
Namespace
:group_member
when
Project
:project_member
else
raise
"Unknown membershipable type:
#{
membershipable
}
!"
end
raise
NotImplementedError
end
def
members_page_url
case
membershipable
when
Namespace
polymorphic_url
([
membershipable
,
:members
])
when
Project
project_project_members_path
(
membershipable
)
else
raise
"Unknown membershipable type:
#{
membershipable
}
!"
end
raise
NotImplementedError
end
def
source_type
@source_type
||=
begin
case
membershipable
when
Namespace
_
(
"group"
)
when
Project
_
(
"project"
)
else
raise
"Unknown membershipable type:
#{
membershipable
}
!"
end
end
raise
NotImplementedError
end
def
plain_source_type
...
...
app/controllers/groups/group_members_controller.rb
View file @
0c8a27f8
...
...
@@ -82,6 +82,18 @@ class Groups::GroupMembersController < Groups::ApplicationController
def
plain_source_type
'group'
end
def
source_type
_
(
"group"
)
end
def
members_page_url
polymorphic_url
([
group
,
:members
])
end
def
root_params_key
:group_member
end
end
Groups
::
GroupMembersController
.
prepend_mod_with
(
'Groups::GroupMembersController'
)
app/controllers/projects/project_members_controller.rb
View file @
0c8a27f8
...
...
@@ -66,6 +66,18 @@ class Projects::ProjectMembersController < Projects::ApplicationController
def
plain_source_type
'project'
end
def
source_type
_
(
"project"
)
end
def
members_page_url
project_project_members_path
(
project
)
end
def
root_params_key
:project_member
end
end
Projects
::
ProjectMembersController
.
prepend_mod_with
(
'Projects::ProjectMembersController'
)
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