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
31fc73f0
Commit
31fc73f0
authored
Mar 13, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `project_member` instead of `team_member`.
parent
99f99575
Changes
24
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
143 additions
and
61 deletions
+143
-61
app/assets/javascripts/dispatcher.js.coffee
app/assets/javascripts/dispatcher.js.coffee
+1
-1
app/assets/stylesheets/generic/common.scss
app/assets/stylesheets/generic/common.scss
+1
-1
app/assets/stylesheets/pages/projects.scss
app/assets/stylesheets/pages/projects.scss
+1
-1
app/controllers/admin/groups_controller.rb
app/controllers/admin/groups_controller.rb
+2
-2
app/controllers/projects/project_members_controller.rb
app/controllers/projects/project_members_controller.rb
+88
-0
app/helpers/search_helper.rb
app/helpers/search_helper.rb
+1
-1
app/helpers/tab_helper.rb
app/helpers/tab_helper.rb
+1
-1
app/models/ability.rb
app/models/ability.rb
+3
-3
app/models/members/project_member.rb
app/models/members/project_member.rb
+2
-2
app/models/project.rb
app/models/project.rb
+2
-2
app/models/user.rb
app/models/user.rb
+1
-4
app/services/notification_service.rb
app/services/notification_service.rb
+6
-6
app/services/projects/participants_service.rb
app/services/projects/participants_service.rb
+2
-2
app/views/admin/groups/show.html.haml
app/views/admin/groups/show.html.haml
+1
-1
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+2
-2
app/views/groups/projects.html.haml
app/views/groups/projects.html.haml
+1
-1
app/views/projects/_dropdown.html.haml
app/views/projects/_dropdown.html.haml
+1
-1
app/views/projects/_settings_nav.html.haml
app/views/projects/_settings_nav.html.haml
+1
-1
config/routes.rb
config/routes.rb
+2
-2
features/steps/admin/groups.rb
features/steps/admin/groups.rb
+1
-1
lib/api/project_members.rb
lib/api/project_members.rb
+14
-14
lib/gitlab/markdown.rb
lib/gitlab/markdown.rb
+1
-1
spec/helpers/gitlab_markdown_helper_spec.rb
spec/helpers/gitlab_markdown_helper_spec.rb
+1
-1
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+7
-10
No files found.
app/assets/javascripts/dispatcher.js.coffee
View file @
31fc73f0
...
@@ -127,7 +127,7 @@ class Dispatcher
...
@@ -127,7 +127,7 @@ class Dispatcher
new
DropzoneInput
(
$
(
'.wiki-form'
))
new
DropzoneInput
(
$
(
'.wiki-form'
))
when
'snippets'
,
'labels'
,
'graphs'
when
'snippets'
,
'labels'
,
'graphs'
shortcut_handler
=
new
ShortcutsNavigation
()
shortcut_handler
=
new
ShortcutsNavigation
()
when
'
team
_members'
,
'deploy_keys'
,
'hooks'
,
'services'
,
'protected_branches'
when
'
project
_members'
,
'deploy_keys'
,
'hooks'
,
'services'
,
'protected_branches'
shortcut_handler
=
new
ShortcutsNavigation
()
shortcut_handler
=
new
ShortcutsNavigation
()
new
UsersSelect
()
new
UsersSelect
()
...
...
app/assets/stylesheets/generic/common.scss
View file @
31fc73f0
...
@@ -167,7 +167,7 @@ li.note {
...
@@ -167,7 +167,7 @@ li.note {
background-color
:
inherit
;
background-color
:
inherit
;
}
}
.
team
_member_show
{
.
project
_member_show
{
td
:first-child
{
td
:first-child
{
color
:
#aaa
;
color
:
#aaa
;
}
}
...
...
app/assets/stylesheets/pages/projects.scss
View file @
31fc73f0
...
@@ -156,7 +156,7 @@ ul.nav.nav-projects-tabs {
...
@@ -156,7 +156,7 @@ ul.nav.nav-projects-tabs {
}
}
}
}
.
team
_member_row
form
{
.
project
_member_row
form
{
margin
:
0px
;
margin
:
0px
;
}
}
...
...
app/controllers/admin/groups_controller.rb
View file @
31fc73f0
class
Admin::GroupsController
<
Admin
::
ApplicationController
class
Admin::GroupsController
<
Admin
::
ApplicationController
before_filter
:group
,
only:
[
:edit
,
:show
,
:update
,
:destroy
,
:project_update
,
:
project_team
s_update
]
before_filter
:group
,
only:
[
:edit
,
:show
,
:update
,
:destroy
,
:project_update
,
:
member
s_update
]
def
index
def
index
@groups
=
Group
.
all
@groups
=
Group
.
all
...
@@ -40,7 +40,7 @@ class Admin::GroupsController < Admin::ApplicationController
...
@@ -40,7 +40,7 @@ class Admin::GroupsController < Admin::ApplicationController
end
end
end
end
def
project_team
s_update
def
member
s_update
@group
.
add_users
(
params
[
:user_ids
].
split
(
','
),
params
[
:access_level
])
@group
.
add_users
(
params
[
:user_ids
].
split
(
','
),
params
[
:access_level
])
redirect_to
[
:admin
,
@group
],
notice:
'Users were successfully added.'
redirect_to
[
:admin
,
@group
],
notice:
'Users were successfully added.'
...
...
app/controllers/projects/
team
_members_controller.rb
→
app/controllers/projects/
project
_members_controller.rb
View file @
31fc73f0
class
Projects::
Team
MembersController
<
Projects
::
ApplicationController
class
Projects::
Project
MembersController
<
Projects
::
ApplicationController
# Authorize
# Authorize
before_filter
:authorize_admin_project!
,
except: :leave
before_filter
:authorize_admin_project!
,
except: :leave
layout
"project_settings"
layout
"project_settings"
def
index
def
index
@project_members
=
@project
.
project_members
if
params
[
:search
].
present?
users
=
@project
.
users
.
search
(
params
[
:search
]).
to_a
@project_members
=
@project_members
.
where
(
user_id:
users
)
end
@project_members
=
@project_members
.
order
(
'access_level DESC'
)
@group
=
@project
.
group
@group
=
@project
.
group
@project_members
=
@project
.
project_members
.
order
(
'access_level DESC'
)
if
@group
@group_members
=
@group
.
group_members
if
params
[
:search
].
present?
users
=
@group
.
users
.
search
(
params
[
:search
]).
to_a
@group_members
=
@group_members
.
where
(
user_id:
users
)
end
@group_members
=
@group_members
.
order
(
'access_level DESC'
).
limit
(
20
)
end
@project_member
=
@project
.
project_members
.
new
end
end
def
new
def
new
@
user_project_relation
=
@project
.
project_members
.
new
@
project_member
=
@project
.
project_members
.
new
end
end
def
create
def
create
users
=
User
.
where
(
id:
params
[
:user_ids
].
split
(
','
))
users
=
User
.
where
(
id:
params
[
:user_ids
].
split
(
','
))
@project
.
team
<<
[
users
,
params
[
:access_level
]]
@project
.
team
<<
[
users
,
params
[
:access_level
]]
redirect_to
namespace_project_
team_index
_path
(
@project
.
namespace
,
@project
)
redirect_to
namespace_project_
project_members
_path
(
@project
.
namespace
,
@project
)
end
end
def
update
def
update
@user_project_relation
=
@project
.
project_members
.
find_by
(
user_id:
member
)
@project_member
=
@project
.
project_members
.
find_by
(
user_id:
member
)
@user_project_relation
.
update_attributes
(
member_params
)
@project_member
.
update_attributes
(
member_params
)
unless
@user_project_relation
.
valid?
flash
[
:alert
]
=
"User should have at least one role"
end
redirect_to
namespace_project_team_index_path
(
@project
.
namespace
,
@project
)
end
end
def
destroy
def
destroy
@
user_project_relation
=
@project
.
project_members
.
find_by
(
user_id:
member
)
@
project_member
=
@project
.
project_members
.
find_by
(
user_id:
member
)
@
user_project_relation
.
destroy
@
project_member
.
destroy
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
do
format
.
html
do
redirect_to
namespace_project_
team_index
_path
(
@project
.
namespace
,
redirect_to
namespace_project_
project_members
_path
(
@project
.
namespace
,
@project
)
@project
)
end
end
format
.
js
{
render
nothing:
true
}
format
.
js
{
render
nothing:
true
}
...
@@ -57,7 +72,7 @@ class Projects::TeamMembersController < Projects::ApplicationController
...
@@ -57,7 +72,7 @@ class Projects::TeamMembersController < Projects::ApplicationController
status
=
@project
.
team
.
import
(
giver
)
status
=
@project
.
team
.
import
(
giver
)
notice
=
status
?
"Successfully imported"
:
"Import failed"
notice
=
status
?
"Successfully imported"
:
"Import failed"
redirect_to
(
namespace_project_
team_index
_path
(
project
.
namespace
,
project
),
redirect_to
(
namespace_project_
project_members
_path
(
project
.
namespace
,
project
),
notice:
notice
)
notice:
notice
)
end
end
...
...
app/helpers/search_helper.rb
View file @
31fc73f0
...
@@ -60,7 +60,7 @@ module SearchHelper
...
@@ -60,7 +60,7 @@ module SearchHelper
{
label:
"
#{
prefix
}
- Merge Requests"
,
url:
namespace_project_merge_requests_path
(
@project
.
namespace
,
@project
)
},
{
label:
"
#{
prefix
}
- Merge Requests"
,
url:
namespace_project_merge_requests_path
(
@project
.
namespace
,
@project
)
},
{
label:
"
#{
prefix
}
- Milestones"
,
url:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
)
},
{
label:
"
#{
prefix
}
- Milestones"
,
url:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
)
},
{
label:
"
#{
prefix
}
- Snippets"
,
url:
namespace_project_snippets_path
(
@project
.
namespace
,
@project
)
},
{
label:
"
#{
prefix
}
- Snippets"
,
url:
namespace_project_snippets_path
(
@project
.
namespace
,
@project
)
},
{
label:
"
#{
prefix
}
-
Team"
,
url:
namespace_project_team_index
_path
(
@project
.
namespace
,
@project
)
},
{
label:
"
#{
prefix
}
-
Members"
,
url:
namespace_project_project_members
_path
(
@project
.
namespace
,
@project
)
},
{
label:
"
#{
prefix
}
- Wiki"
,
url:
namespace_project_wikis_path
(
@project
.
namespace
,
@project
)
},
{
label:
"
#{
prefix
}
- Wiki"
,
url:
namespace_project_wikis_path
(
@project
.
namespace
,
@project
)
},
]
]
else
else
...
...
app/helpers/tab_helper.rb
View file @
31fc73f0
...
@@ -89,7 +89,7 @@ module TabHelper
...
@@ -89,7 +89,7 @@ module TabHelper
def
project_tab_class
def
project_tab_class
return
"active"
if
current_page?
(
controller:
"/projects"
,
action: :edit
,
id:
@project
)
return
"active"
if
current_page?
(
controller:
"/projects"
,
action: :edit
,
id:
@project
)
if
[
'services'
,
'hooks'
,
'deploy_keys'
,
'
team
_members'
,
'protected_branches'
].
include?
controller
.
controller_name
if
[
'services'
,
'hooks'
,
'deploy_keys'
,
'
project
_members'
,
'protected_branches'
].
include?
controller
.
controller_name
"active"
"active"
end
end
end
end
...
...
app/models/ability.rb
View file @
31fc73f0
...
@@ -37,7 +37,7 @@ class Ability
...
@@ -37,7 +37,7 @@ class Ability
:read_issue
,
:read_issue
,
:read_milestone
,
:read_milestone
,
:read_project_snippet
,
:read_project_snippet
,
:read_
team
_member
,
:read_
project
_member
,
:read_merge_request
,
:read_merge_request
,
:read_note
,
:read_note
,
:download_code
:download_code
...
@@ -119,7 +119,7 @@ class Ability
...
@@ -119,7 +119,7 @@ class Ability
:read_issue
,
:read_issue
,
:read_milestone
,
:read_milestone
,
:read_project_snippet
,
:read_project_snippet
,
:read_
team
_member
,
:read_
project
_member
,
:read_merge_request
,
:read_merge_request
,
:read_note
,
:read_note
,
:write_project
,
:write_project
,
...
@@ -166,7 +166,7 @@ class Ability
...
@@ -166,7 +166,7 @@ class Ability
:admin_issue
,
:admin_issue
,
:admin_milestone
,
:admin_milestone
,
:admin_project_snippet
,
:admin_project_snippet
,
:admin_
team
_member
,
:admin_
project
_member
,
:admin_merge_request
,
:admin_merge_request
,
:admin_note
,
:admin_note
,
:admin_wiki
,
:admin_wiki
,
...
...
app/models/members/project_member.rb
View file @
31fc73f0
...
@@ -116,14 +116,14 @@ class ProjectMember < Member
...
@@ -116,14 +116,14 @@ class ProjectMember < Member
def
post_create_hook
def
post_create_hook
unless
owner?
unless
owner?
event_service
.
join_project
(
self
.
project
,
self
.
user
)
event_service
.
join_project
(
self
.
project
,
self
.
user
)
notification_service
.
new_
team
_member
(
self
)
notification_service
.
new_
project
_member
(
self
)
end
end
system_hook_service
.
execute_hooks_for
(
self
,
:create
)
system_hook_service
.
execute_hooks_for
(
self
,
:create
)
end
end
def
post_update_hook
def
post_update_hook
notification_service
.
update_
team
_member
(
self
)
if
self
.
access_level_changed?
notification_service
.
update_
project
_member
(
self
)
if
self
.
access_level_changed?
end
end
def
post_destroy_hook
def
post_destroy_hook
...
...
app/models/project.rb
View file @
31fc73f0
...
@@ -445,13 +445,13 @@ class Project < ActiveRecord::Base
...
@@ -445,13 +445,13 @@ class Project < ActiveRecord::Base
end
end
end
end
def
team
_member_by_name_or_email
(
name
=
nil
,
email
=
nil
)
def
project
_member_by_name_or_email
(
name
=
nil
,
email
=
nil
)
user
=
users
.
where
(
'name like ? or email like ?'
,
name
,
email
).
first
user
=
users
.
where
(
'name like ? or email like ?'
,
name
,
email
).
first
project_members
.
where
(
user:
user
)
if
user
project_members
.
where
(
user:
user
)
if
user
end
end
# Get Team Member record by user id
# Get Team Member record by user id
def
team
_member_by_id
(
user_id
)
def
project
_member_by_id
(
user_id
)
project_members
.
find_by
(
user_id:
user_id
)
project_members
.
find_by
(
user_id:
user_id
)
end
end
...
...
app/models/user.rb
View file @
31fc73f0
...
@@ -169,11 +169,8 @@ class User < ActiveRecord::Base
...
@@ -169,11 +169,8 @@ class User < ActiveRecord::Base
scope
:admins
,
->
{
where
(
admin:
true
)
}
scope
:admins
,
->
{
where
(
admin:
true
)
}
scope
:blocked
,
->
{
with_state
(
:blocked
)
}
scope
:blocked
,
->
{
with_state
(
:blocked
)
}
scope
:active
,
->
{
with_state
(
:active
)
}
scope
:active
,
->
{
with_state
(
:active
)
}
scope
:in_team
,
->
(
team
){
where
(
id:
team
.
member_ids
)
}
scope
:not_in_team
,
->
(
team
){
where
(
'users.id NOT IN (:ids)'
,
ids:
team
.
member_ids
)
}
scope
:not_in_project
,
->
(
project
)
{
project
.
users
.
present?
?
where
(
"id not in (:ids)"
,
ids:
project
.
users
.
map
(
&
:id
)
)
:
all
}
scope
:not_in_project
,
->
(
project
)
{
project
.
users
.
present?
?
where
(
"id not in (:ids)"
,
ids:
project
.
users
.
map
(
&
:id
)
)
:
all
}
scope
:without_projects
,
->
{
where
(
'id NOT IN (SELECT DISTINCT(user_id) FROM members)'
)
}
scope
:without_projects
,
->
{
where
(
'id NOT IN (SELECT DISTINCT(user_id) FROM members)'
)
}
scope
:potential_team_members
,
->
(
team
)
{
team
.
members
.
any?
?
active
.
not_in_team
(
team
)
:
active
}
#
#
# Class methods
# Class methods
...
@@ -407,7 +404,7 @@ class User < ActiveRecord::Base
...
@@ -407,7 +404,7 @@ class User < ActiveRecord::Base
end
end
def
tm_of
(
project
)
def
tm_of
(
project
)
project
.
team
_member_by_id
(
self
.
id
)
project
.
project
_member_by_id
(
self
.
id
)
end
end
def
already_forked?
(
project
)
def
already_forked?
(
project
)
...
...
app/services/notification_service.rb
View file @
31fc73f0
...
@@ -162,20 +162,20 @@ class NotificationService
...
@@ -162,20 +162,20 @@ class NotificationService
end
end
end
end
def
new_
team
_member
(
project_member
)
def
new_
project
_member
(
project_member
)
mailer
.
project_access_granted_email
(
project_member
.
id
)
mailer
.
project_access_granted_email
(
project_member
.
id
)
end
end
def
update_
team
_member
(
project_member
)
def
update_
project
_member
(
project_member
)
mailer
.
project_access_granted_email
(
project_member
.
id
)
mailer
.
project_access_granted_email
(
project_member
.
id
)
end
end
def
new_group_member
(
users_group
)
def
new_group_member
(
group_member
)
mailer
.
group_access_granted_email
(
users_group
.
id
)
mailer
.
group_access_granted_email
(
group_member
.
id
)
end
end
def
update_group_member
(
users_group
)
def
update_group_member
(
group_member
)
mailer
.
group_access_granted_email
(
users_group
.
id
)
mailer
.
group_access_granted_email
(
group_member
.
id
)
end
end
def
project_was_moved
(
project
)
def
project_was_moved
(
project
)
...
...
app/services/projects/participants_service.rb
View file @
31fc73f0
...
@@ -12,8 +12,8 @@ module Projects
...
@@ -12,8 +12,8 @@ module Projects
else
else
[]
[]
end
end
team
_members
=
sorted
(
@project
.
team
.
members
)
project
_members
=
sorted
(
@project
.
team
.
members
)
participants
=
all_members
+
groups
+
team
_members
+
participating
participants
=
all_members
+
groups
+
project
_members
+
participating
participants
.
uniq
participants
.
uniq
end
end
...
...
app/views/admin/groups/show.html.haml
View file @
31fc73f0
...
@@ -58,7 +58,7 @@
...
@@ -58,7 +58,7 @@
Read more about project permissions
Read more about project permissions
%strong
=
link_to
"here"
,
help_page_path
(
"permissions"
,
"permissions"
),
class:
"vlink"
%strong
=
link_to
"here"
,
help_page_path
(
"permissions"
,
"permissions"
),
class:
"vlink"
=
form_tag
project_teams_update_admin_group_path
(
@group
),
id:
"new_team
_member"
,
class:
"bulk_import"
,
method: :put
do
=
form_tag
members_update_admin_group_path
(
@group
),
id:
"new_project
_member"
,
class:
"bulk_import"
,
method: :put
do
%div
%div
=
users_select_tag
(
:user_ids
,
multiple:
true
)
=
users_select_tag
(
:user_ids
,
multiple:
true
)
%div
.prepend-top-10
%div
.prepend-top-10
...
...
app/views/admin/projects/show.html.haml
View file @
31fc73f0
...
@@ -114,7 +114,7 @@
...
@@ -114,7 +114,7 @@
=
link_to
namespace_project_team_index_path
(
@project
.
namespace
,
@project
),
class:
"btn btn-xs"
do
=
link_to
namespace_project_team_index_path
(
@project
.
namespace
,
@project
),
class:
"btn btn-xs"
do
%i
.fa.fa-pencil-square-o
%i
.fa.fa-pencil-square-o
Manage Access
Manage Access
%ul
.well-list.
team
_members
%ul
.well-list.
project
_members
-
@project_members
.
each
do
|
project_member
|
-
@project_members
.
each
do
|
project_member
|
-
user
=
project_member
.
user
-
user
=
project_member
.
user
%li
.project_member
%li
.project_member
...
@@ -126,7 +126,7 @@
...
@@ -126,7 +126,7 @@
%span
.light
Owner
%span
.light
Owner
-
else
-
else
%span
.light
=
project_member
.
human_access
%span
.light
=
project_member
.
human_access
=
link_to
namespace_project_
team
_member_path
(
@project
.
namespace
,
@project
,
user
),
data:
{
confirm:
remove_from_project_team_message
(
@project
,
user
)},
method: :delete
,
remote:
true
,
class:
"btn btn-sm btn-remove"
do
=
link_to
namespace_project_
project
_member_path
(
@project
.
namespace
,
@project
,
user
),
data:
{
confirm:
remove_from_project_team_message
(
@project
,
user
)},
method: :delete
,
remote:
true
,
class:
"btn btn-sm btn-remove"
do
%i
.fa.fa-times
%i
.fa.fa-times
.panel-footer
.panel-footer
=
paginate
@project_members
,
param_name:
'project_members_page'
,
theme:
'gitlab'
=
paginate
@project_members
,
param_name:
'project_members_page'
,
theme:
'gitlab'
app/views/groups/projects.html.haml
View file @
31fc73f0
...
@@ -16,7 +16,7 @@
...
@@ -16,7 +16,7 @@
%span
.label.label-gray
%span
.label.label-gray
=
repository_size
(
project
)
=
repository_size
(
project
)
.pull-right
.pull-right
=
link_to
'Members'
,
namespace_project_
team_index
_path
(
project
.
namespace
,
project
),
id:
"edit_
#{
dom_id
(
project
)
}
"
,
class:
"btn btn-sm"
=
link_to
'Members'
,
namespace_project_
project_members
_path
(
project
.
namespace
,
project
),
id:
"edit_
#{
dom_id
(
project
)
}
"
,
class:
"btn btn-sm"
=
link_to
'Edit'
,
edit_namespace_project_path
(
project
.
namespace
,
project
),
id:
"edit_
#{
dom_id
(
project
)
}
"
,
class:
"btn btn-sm"
=
link_to
'Edit'
,
edit_namespace_project_path
(
project
.
namespace
,
project
),
id:
"edit_
#{
dom_id
(
project
)
}
"
,
class:
"btn btn-sm"
=
link_to
'Remove'
,
project
,
data:
{
confirm:
remove_project_message
(
project
)},
method: :delete
,
class:
"btn btn-sm btn-remove"
=
link_to
'Remove'
,
project
,
data:
{
confirm:
remove_project_message
(
project
)},
method: :delete
,
class:
"btn btn-sm btn-remove"
-
if
@projects
.
blank?
-
if
@projects
.
blank?
...
...
app/views/projects/_dropdown.html.haml
View file @
31fc73f0
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
%li
%li
=
link_to
new_namespace_project_snippet_path
(
@project
.
namespace
,
@project
),
title:
"New Snippet"
do
=
link_to
new_namespace_project_snippet_path
(
@project
.
namespace
,
@project
),
title:
"New Snippet"
do
New snippet
New snippet
-
if
can?
(
current_user
,
:admin_
team
_member
,
@project
)
-
if
can?
(
current_user
,
:admin_
project
_member
,
@project
)
%li
%li
=
link_to
new_namespace_project_team_member_path
(
@project
.
namespace
,
@project
),
title:
"New project member"
do
=
link_to
new_namespace_project_team_member_path
(
@project
.
namespace
,
@project
),
title:
"New project member"
do
New project member
New project member
...
...
app/views/projects/_settings_nav.html.haml
View file @
31fc73f0
...
@@ -4,8 +4,8 @@
...
@@ -4,8 +4,8 @@
%i
.fa.fa-pencil-square-o
%i
.fa.fa-pencil-square-o
%span
%span
Project
Project
=
nav_link
(
controller:
[
:team_members
,
:teams
])
do
=
link_to
namespace_project_team_index_path
(
@project
.
namespace
,
@project
),
title:
'Members'
,
class:
"team-tab tab"
do
=
link_to
namespace_project_team_index_path
(
@project
.
namespace
,
@project
),
title:
'Members'
,
class:
"team-tab tab"
do
=
nav_link
(
controller:
[
:project_members
,
:teams
])
do
%i
.fa.fa-users
%i
.fa.fa-users
%span
%span
Members
Members
...
...
config/routes.rb
View file @
31fc73f0
...
@@ -136,7 +136,7 @@ Gitlab::Application.routes.draw do
...
@@ -136,7 +136,7 @@ Gitlab::Application.routes.draw do
resources
:groups
,
constraints:
{
id:
/[^\/]+/
}
do
resources
:groups
,
constraints:
{
id:
/[^\/]+/
}
do
member
do
member
do
put
:
project_team
s_update
put
:
member
s_update
end
end
end
end
...
@@ -445,7 +445,7 @@ Gitlab::Application.routes.draw do
...
@@ -445,7 +445,7 @@ Gitlab::Application.routes.draw do
end
end
end
end
resources
:
team_members
,
except:
[
:index
,
:edit
],
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
}
do
resources
:
project_members
,
except:
[
:new
,
:edit
],
constraints:
{
id:
/[a-zA-Z.\/0-9_\-#%+]+/
}
do
collection
do
collection
do
delete
:leave
delete
:leave
...
...
features/steps/admin/groups.rb
View file @
31fc73f0
...
@@ -38,7 +38,7 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
...
@@ -38,7 +38,7 @@ class Spinach::Features::AdminGroups < Spinach::FeatureSteps
When
'I select user "John Doe" from user list as "Reporter"'
do
When
'I select user "John Doe" from user list as "Reporter"'
do
select2
(
user_john
.
id
,
from:
"#user_ids"
,
multiple:
true
)
select2
(
user_john
.
id
,
from:
"#user_ids"
,
multiple:
true
)
within
"#new_
team
_member"
do
within
"#new_
project
_member"
do
select
"Reporter"
,
from:
"access_level"
select
"Reporter"
,
from:
"access_level"
end
end
click_button
"Add users to group"
click_button
"Add users to group"
...
...
lib/api/project_members.rb
View file @
31fc73f0
...
@@ -46,19 +46,19 @@ module API
...
@@ -46,19 +46,19 @@ module API
required_attributes!
[
:user_id
,
:access_level
]
required_attributes!
[
:user_id
,
:access_level
]
# either the user is already a team member or a new one
# either the user is already a team member or a new one
team_member
=
user_project
.
team
_member_by_id
(
params
[
:user_id
])
project_member
=
user_project
.
project
_member_by_id
(
params
[
:user_id
])
if
team
_member
.
nil?
if
project
_member
.
nil?
team
_member
=
user_project
.
project_members
.
new
(
project
_member
=
user_project
.
project_members
.
new
(
user_id:
params
[
:user_id
],
user_id:
params
[
:user_id
],
access_level:
params
[
:access_level
]
access_level:
params
[
:access_level
]
)
)
end
end
if
team
_member
.
save
if
project
_member
.
save
@member
=
team
_member
.
user
@member
=
project
_member
.
user
present
@member
,
with:
Entities
::
ProjectMember
,
project:
user_project
present
@member
,
with:
Entities
::
ProjectMember
,
project:
user_project
else
else
handle_member_errors
team
_member
.
errors
handle_member_errors
project
_member
.
errors
end
end
end
end
...
@@ -74,14 +74,14 @@ module API
...
@@ -74,14 +74,14 @@ module API
authorize!
:admin_project
,
user_project
authorize!
:admin_project
,
user_project
required_attributes!
[
:access_level
]
required_attributes!
[
:access_level
]
team
_member
=
user_project
.
project_members
.
find_by
(
user_id:
params
[
:user_id
])
project
_member
=
user_project
.
project_members
.
find_by
(
user_id:
params
[
:user_id
])
not_found!
(
"User can not be found"
)
if
team
_member
.
nil?
not_found!
(
"User can not be found"
)
if
project
_member
.
nil?
if
team
_member
.
update_attributes
(
access_level:
params
[
:access_level
])
if
project
_member
.
update_attributes
(
access_level:
params
[
:access_level
])
@member
=
team
_member
.
user
@member
=
project
_member
.
user
present
@member
,
with:
Entities
::
ProjectMember
,
project:
user_project
present
@member
,
with:
Entities
::
ProjectMember
,
project:
user_project
else
else
handle_member_errors
team
_member
.
errors
handle_member_errors
project
_member
.
errors
end
end
end
end
...
@@ -94,9 +94,9 @@ module API
...
@@ -94,9 +94,9 @@ module API
# DELETE /projects/:id/members/:user_id
# DELETE /projects/:id/members/:user_id
delete
":id/members/:user_id"
do
delete
":id/members/:user_id"
do
authorize!
:admin_project
,
user_project
authorize!
:admin_project
,
user_project
team
_member
=
user_project
.
project_members
.
find_by
(
user_id:
params
[
:user_id
])
project
_member
=
user_project
.
project_members
.
find_by
(
user_id:
params
[
:user_id
])
unless
team
_member
.
nil?
unless
project
_member
.
nil?
team
_member
.
destroy
project
_member
.
destroy
else
else
{
message:
"Access revoked"
,
id:
params
[
:user_id
].
to_i
}
{
message:
"Access revoked"
,
id:
params
[
:user_id
].
to_i
}
end
end
...
...
lib/gitlab/markdown.rb
View file @
31fc73f0
...
@@ -200,7 +200,7 @@ module Gitlab
...
@@ -200,7 +200,7 @@ module Gitlab
def
reference_user
(
identifier
,
project
=
@project
,
_
=
nil
)
def
reference_user
(
identifier
,
project
=
@project
,
_
=
nil
)
options
=
html_options
.
merge
(
options
=
html_options
.
merge
(
class:
"gfm gfm-
team
_member
#{
html_options
[
:class
]
}
"
class:
"gfm gfm-
project
_member
#{
html_options
[
:class
]
}
"
)
)
if
identifier
==
"all"
if
identifier
==
"all"
...
...
spec/helpers/gitlab_markdown_helper_spec.rb
View file @
31fc73f0
...
@@ -180,7 +180,7 @@ describe GitlabMarkdownHelper do
...
@@ -180,7 +180,7 @@ describe GitlabMarkdownHelper do
end
end
it
"should include standard gfm classes"
do
it
"should include standard gfm classes"
do
expect
(
gfm
(
actual
)).
to
match
(
/class="\s?gfm gfm-
team
_member\s?"/
)
expect
(
gfm
(
actual
)).
to
match
(
/class="\s?gfm gfm-
project
_member\s?"/
)
end
end
end
end
...
...
spec/routing/project_routing_spec.rb
View file @
31fc73f0
...
@@ -338,17 +338,14 @@ describe Projects::CommitsController, 'routing' do
...
@@ -338,17 +338,14 @@ describe Projects::CommitsController, 'routing' do
end
end
end
end
# project_team_members GET /:project_id/team_members(.:format) team_members#index
# project_project_members GET /:project_id/project_members(.:format) project_members#index
# POST /:project_id/team_members(.:format) team_members#create
# POST /:project_id/project_members(.:format) project_members#create
# new_project_team_member GET /:project_id/team_members/new(.:format) team_members#new
# PUT /:project_id/project_members/:id(.:format) project_members#update
# edit_project_team_member GET /:project_id/team_members/:id/edit(.:format) team_members#edit
# DELETE /:project_id/project_members/:id(.:format) project_members#destroy
# project_team_member GET /:project_id/team_members/:id(.:format) team_members#show
describe
Projects
::
ProjectMembersController
,
'routing'
do
# PUT /:project_id/team_members/:id(.:format) team_members#update
# DELETE /:project_id/team_members/:id(.:format) team_members#destroy
describe
Projects
::
TeamMembersController
,
'routing'
do
it_behaves_like
'RESTful project resources'
do
it_behaves_like
'RESTful project resources'
do
let
(
:actions
)
{
[
:
new
,
:create
,
:update
,
:destroy
]
}
let
(
:actions
)
{
[
:
index
,
:create
,
:update
,
:destroy
]
}
let
(
:controller
)
{
'
team
_members'
}
let
(
:controller
)
{
'
project
_members'
}
end
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