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
15a66339
Commit
15a66339
authored
Feb 17, 2016
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert authors ability to assign anyone
parent
829830ae
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
11 additions
and
35 deletions
+11
-35
app/controllers/autocomplete_controller.rb
app/controllers/autocomplete_controller.rb
+1
-1
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+0
-5
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+3
-8
app/services/issues/base_service.rb
app/services/issues/base_service.rb
+2
-2
app/services/merge_requests/base_service.rb
app/services/merge_requests/base_service.rb
+2
-2
app/views/shared/issuable/_sidebar.html.haml
app/views/shared/issuable/_sidebar.html.haml
+1
-1
spec/controllers/autocomplete_controller_spec.rb
spec/controllers/autocomplete_controller_spec.rb
+2
-2
spec/models/concerns/issuable_spec.rb
spec/models/concerns/issuable_spec.rb
+0
-14
No files found.
app/controllers/autocomplete_controller.rb
View file @
15a66339
...
@@ -15,7 +15,7 @@ class AutocompleteController < ApplicationController
...
@@ -15,7 +15,7 @@ class AutocompleteController < ApplicationController
@users
=
[
*
@users
,
current_user
]
@users
=
[
*
@users
,
current_user
]
end
end
unless
params
[
:author_id
]
=
=
"false"
if
params
[
:author_id
]
&&
params
[
:author_id
]
!
=
"false"
@users
=
[
User
.
find
(
params
[
:author_id
]),
*
@users
]
@users
=
[
User
.
find
(
params
[
:author_id
]),
*
@users
]
end
end
...
...
app/models/concerns/issuable.rb
View file @
15a66339
...
@@ -116,11 +116,6 @@ module Issuable
...
@@ -116,11 +116,6 @@ module Issuable
assignee_id_changed?
assignee_id_changed?
end
end
def
can_assign_user?
(
current_user
)
author
==
current_user
||
Ability
.
abilities
.
allowed?
(
current_user
,
:"admin_
#{
to_ability_name
}
"
,
project
)
end
def
open?
def
open?
opened?
||
reopened?
opened?
||
reopened?
end
end
...
...
app/services/issuable_base_service.rb
View file @
15a66339
...
@@ -33,7 +33,7 @@ class IssuableBaseService < BaseService
...
@@ -33,7 +33,7 @@ class IssuableBaseService < BaseService
end
end
end
end
def
filter_params
(
issuable_ability_name
,
issuabl
e
)
def
filter_params
(
issuable_ability_name
=
:issu
e
)
params
[
:assignee_id
]
=
""
if
params
[
:assignee_id
]
==
IssuableFinder
::
NONE
params
[
:assignee_id
]
=
""
if
params
[
:assignee_id
]
==
IssuableFinder
::
NONE
params
[
:milestone_id
]
=
""
if
params
[
:milestone_id
]
==
IssuableFinder
::
NONE
params
[
:milestone_id
]
=
""
if
params
[
:milestone_id
]
==
IssuableFinder
::
NONE
...
@@ -42,18 +42,13 @@ class IssuableBaseService < BaseService
...
@@ -42,18 +42,13 @@ class IssuableBaseService < BaseService
unless
can?
(
current_user
,
ability
,
project
)
unless
can?
(
current_user
,
ability
,
project
)
params
.
delete
(
:milestone_id
)
params
.
delete
(
:milestone_id
)
params
.
delete
(
:label_ids
)
params
.
delete
(
:label_ids
)
# The author of an issue can be assigned, to signal the ball being in his/her
# court. This allow him/her to reassign the issue back to the reviewer.
if
issuable
&&
!
(
issuable
.
author
==
current_user
)
params
.
delete
(
:assignee_id
)
params
.
delete
(
:assignee_id
)
end
end
end
end
end
def
update
(
issuable
)
def
update
(
issuable
)
change_state
(
issuable
)
change_state
(
issuable
)
filter_params
(
issuable
)
filter_params
old_labels
=
issuable
.
labels
.
to_a
old_labels
=
issuable
.
labels
.
to_a
if
params
.
present?
&&
issuable
.
update_attributes
(
params
.
merge
(
updated_by:
current_user
))
if
params
.
present?
&&
issuable
.
update_attributes
(
params
.
merge
(
updated_by:
current_user
))
...
...
app/services/issues/base_service.rb
View file @
15a66339
...
@@ -10,8 +10,8 @@ module Issues
...
@@ -10,8 +10,8 @@ module Issues
private
private
def
filter_params
(
issuable
=
nil
)
def
filter_params
super
(
:issue
,
issuable
)
super
(
:issue
)
end
end
def
execute_hooks
(
issue
,
action
=
'open'
)
def
execute_hooks
(
issue
,
action
=
'open'
)
...
...
app/services/merge_requests/base_service.rb
View file @
15a66339
...
@@ -23,8 +23,8 @@ module MergeRequests
...
@@ -23,8 +23,8 @@ module MergeRequests
private
private
def
filter_params
(
issuable
=
nil
)
def
filter_params
super
(
:merge_request
,
issuable
)
super
(
:merge_request
)
end
end
end
end
end
end
app/views/shared/issuable/_sidebar.html.haml
View file @
15a66339
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
.title
.title
%label
%label
Assignee
Assignee
-
if
issuable
.
can_assign_user?
(
current_user
)
-
if
can?
(
current_user
,
:"admin_
#{
issuable
.
to_ability_name
}
"
,
@project
)
.pull-right
.pull-right
=
link_to
'Edit'
,
'#'
,
class:
'edit-link'
=
link_to
'Edit'
,
'#'
,
class:
'edit-link'
.value
.value
...
...
spec/controllers/autocomplete_controller_spec.rb
View file @
15a66339
...
@@ -12,13 +12,13 @@ describe AutocompleteController do
...
@@ -12,13 +12,13 @@ describe AutocompleteController do
project
.
team
<<
[
user
,
:master
]
project
.
team
<<
[
user
,
:master
]
end
end
let
(
:body
)
{
JSON
.
parse
(
response
.
body
)
}
describe
'GET #users with project ID'
do
describe
'GET #users with project ID'
do
before
do
before
do
get
(
:users
,
project_id:
project
.
id
)
get
(
:users
,
project_id:
project
.
id
)
end
end
let
(
:body
)
{
JSON
.
parse
(
response
.
body
)
}
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
).
to
be_kind_of
(
Array
)
}
it
{
expect
(
body
.
size
).
to
eq
1
}
it
{
expect
(
body
.
size
).
to
eq
1
}
it
{
expect
(
body
.
first
[
"username"
]).
to
eq
user
.
username
}
it
{
expect
(
body
.
first
[
"username"
]).
to
eq
user
.
username
}
...
...
spec/models/concerns/issuable_spec.rb
View file @
15a66339
...
@@ -111,20 +111,6 @@ describe Issue, "Issuable" do
...
@@ -111,20 +111,6 @@ describe Issue, "Issuable" do
end
end
end
end
describe
"#can_assign_user?"
do
let
(
:author
)
{
build
(
:user
)
}
let
(
:issue
)
{
build
(
:issue
,
author:
author
)}
it
"Allows the author to change the assignee"
do
expect
(
issue
.
can_assign_user?
(
author
)).
to
be_truthy
end
it
"Doesn't allow others, non-team members"
do
other_user
=
build
(
:user
)
expect
(
issue
.
can_assign_user?
(
other_user
)).
to
be_falsey
end
end
describe
"votes"
do
describe
"votes"
do
before
do
before
do
author
=
create
:user
author
=
create
:user
...
...
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