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
766a35af
Commit
766a35af
authored
Mar 27, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Multiple issue assignees] Fix hook_attrs
parent
7b64b205
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
8 deletions
+20
-8
app/controllers/projects/boards/issues_controller.rb
app/controllers/projects/boards/issues_controller.rb
+1
-1
app/models/concerns/issuable.rb
app/models/concerns/issuable.rb
+5
-1
app/models/issue.rb
app/models/issue.rb
+3
-2
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+7
-1
spec/services/issues/create_service_spec.rb
spec/services/issues/create_service_spec.rb
+4
-3
No files found.
app/controllers/projects/boards/issues_controller.rb
View file @
766a35af
...
...
@@ -82,7 +82,7 @@ module Projects
labels:
true
,
only:
[
:id
,
:iid
,
:title
,
:confidential
,
:due_date
,
:relative_position
],
include:
{
assignee:
{
only:
[
:id
,
:name
,
:username
],
methods:
[
:avatar_url
]
},
assignee
s
:
{
only:
[
:id
,
:name
,
:username
],
methods:
[
:avatar_url
]
},
milestone:
{
only:
[
:id
,
:title
]
}
},
user:
current_user
...
...
app/models/concerns/issuable.rb
View file @
766a35af
...
...
@@ -277,7 +277,11 @@ module Issuable
# DEPRECATED
repository:
project
.
hook_attrs
.
slice
(
:name
,
:url
,
:description
,
:homepage
)
}
hook_data
[
:assignee
]
=
assignee
.
hook_attrs
if
assignee
if
self
.
is_a?
(
Issue
)
hook_data
[
:assignees
]
=
assignees
.
map
(
&
:hook_attrs
)
if
assignees
.
any?
else
hook_data
[
:assignee
]
=
assignee
.
hook_attrs
if
assignee
end
hook_data
end
...
...
app/models/issue.rb
View file @
766a35af
...
...
@@ -33,9 +33,10 @@ class Issue < ActiveRecord::Base
validates
:project
,
presence:
true
scope
:cared
,
->
(
user
)
{
w
here
(
assignee_id:
user
)
}
scope
:cared
,
->
(
user
)
{
w
ith_assignees
.
where
(
"issue_assignees.user_id IN(?)"
,
user
.
id
)
}
scope
:open_for
,
->
(
user
)
{
opened
.
assigned_to
(
user
)
}
scope
:in_projects
,
->
(
project_ids
)
{
where
(
project_id:
project_ids
)
}
scope
:with_assignees
,
->
{
joins
(
:assignees
)
}
scope
:without_due_date
,
->
{
where
(
due_date:
nil
)
}
scope
:due_before
,
->
(
date
)
{
where
(
'issues.due_date < ?'
,
date
)
}
...
...
@@ -287,7 +288,7 @@ class Issue < ActiveRecord::Base
true
elsif
confidential?
author
==
user
||
assignee
==
user
||
assignee
s
.
include?
(
user
)
||
project
.
team
.
member?
(
user
,
Gitlab
::
Access
::
REPORTER
)
else
project
.
public?
||
...
...
app/services/issuable_base_service.rb
View file @
766a35af
...
...
@@ -48,7 +48,13 @@ class IssuableBaseService < BaseService
params
.
delete
(
:add_label_ids
)
params
.
delete
(
:remove_label_ids
)
params
.
delete
(
:label_ids
)
params
.
delete
(
:assignee_id
)
if
issuable
.
is_a?
(
Issue
)
params
.
delete
(
:assignee_ids
)
else
params
.
delete
(
:assignee_id
)
end
params
.
delete
(
:due_date
)
end
...
...
spec/services/issues/create_service_spec.rb
View file @
766a35af
...
...
@@ -20,7 +20,7 @@ describe Issues::CreateService, services: true do
let
(
:opts
)
do
{
title:
'Awesome issue'
,
description:
'please fix'
,
assignee_id
:
assignee
.
id
,
assignee_id
s:
assignee
.
id
.
to_s
,
label_ids:
labels
.
map
(
&
:id
),
milestone_id:
milestone
.
id
,
due_date:
Date
.
tomorrow
}
...
...
@@ -29,7 +29,7 @@ describe Issues::CreateService, services: true do
it
'creates the issue with the given params'
do
expect
(
issue
).
to
be_persisted
expect
(
issue
.
title
).
to
eq
(
'Awesome issue'
)
expect
(
issue
.
assignee
).
to
eq
assignee
expect
(
issue
.
assignee
s
).
to
eq
[
assignee
]
expect
(
issue
.
labels
).
to
match_array
labels
expect
(
issue
.
milestone
).
to
eq
milestone
expect
(
issue
.
due_date
).
to
eq
Date
.
tomorrow
...
...
@@ -37,6 +37,7 @@ describe Issues::CreateService, services: true do
context
'when current user cannot admin issues in the project'
do
let
(
:guest
)
{
create
(
:user
)
}
before
do
project
.
team
<<
[
guest
,
:guest
]
end
...
...
@@ -47,7 +48,7 @@ describe Issues::CreateService, services: true do
expect
(
issue
).
to
be_persisted
expect
(
issue
.
title
).
to
eq
(
'Awesome issue'
)
expect
(
issue
.
description
).
to
eq
(
'please fix'
)
expect
(
issue
.
assignee
).
to
be_nil
expect
(
issue
.
assignee
s
).
to
be_empty
expect
(
issue
.
labels
).
to
be_empty
expect
(
issue
.
milestone
).
to
be_nil
expect
(
issue
.
due_date
).
to
be_nil
...
...
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