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
985f8b1a
Commit
985f8b1a
authored
Mar 29, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Multiple Issue Assignee] fix specs
parent
051c8d63
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
47 additions
and
29 deletions
+47
-29
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-1
app/models/issue.rb
app/models/issue.rb
+2
-2
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+5
-1
app/services/merge_requests/assign_issues_service.rb
app/services/merge_requests/assign_issues_service.rb
+1
-1
app/services/merge_requests/update_service.rb
app/services/merge_requests/update_service.rb
+4
-1
app/views/notify/_reassigned_issuable_email.text.erb
app/views/notify/_reassigned_issuable_email.text.erb
+2
-2
app/views/notify/reassigned_issue_email.html.haml
app/views/notify/reassigned_issue_email.html.haml
+1
-1
app/views/shared/issuable/form/_issue_assignee.html.haml
app/views/shared/issuable/form/_issue_assignee.html.haml
+1
-1
app/views/shared/issuable/form/_metadata.html.haml
app/views/shared/issuable/form/_metadata.html.haml
+18
-7
spec/features/boards/boards_spec.rb
spec/features/boards/boards_spec.rb
+1
-1
spec/features/issues/filtered_search/filter_issues_spec.rb
spec/features/issues/filtered_search/filter_issues_spec.rb
+5
-5
spec/features/merge_requests/assign_issues_spec.rb
spec/features/merge_requests/assign_issues_spec.rb
+1
-1
spec/mailers/notify_spec.rb
spec/mailers/notify_spec.rb
+5
-5
No files found.
app/controllers/projects/issues_controller.rb
View file @
985f8b1a
...
...
@@ -65,7 +65,7 @@ class Projects::IssuesController < Projects::ApplicationController
def
new
params
[
:issue
]
||=
ActionController
::
Parameters
.
new
(
assignee_id:
""
assignee_id
s
:
""
)
build_params
=
issue_params
.
merge
(
merge_request_to_resolve_discussions_of:
params
[
:merge_request_to_resolve_discussions_of
],
...
...
app/models/issue.rb
View file @
985f8b1a
...
...
@@ -36,7 +36,7 @@ class Issue < ActiveRecord::Base
scope
:cared
,
->
(
user
)
{
with_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
,
->
{
includes
(
:assignees
).
references
(
:users
)
}
scope
:with_assignees
,
->
{
joins
(
'LEFT JOIN issue_assignees ON issue_id = issues.id'
)
}
scope
:without_due_date
,
->
{
where
(
due_date:
nil
)
}
scope
:due_before
,
->
(
date
)
{
where
(
'issues.due_date < ?'
,
date
)
}
...
...
@@ -145,7 +145,7 @@ class Issue < ActiveRecord::Base
end
def
assignee_list
assignees
.
map
(
&
:
to_referenc
e
).
to_sentence
assignees
.
map
(
&
:
nam
e
).
to_sentence
end
# TODO: This method will help us to find some silent failures.
...
...
app/services/issues/update_service.rb
View file @
985f8b1a
...
...
@@ -12,7 +12,11 @@ module Issues
spam_check
(
issue
,
current_user
)
end
def
handle_changes
(
issue
,
old_labels:
[],
old_mentioned_users:
[],
old_assignees:
[])
def
handle_changes
(
issue
,
options
)
old_labels
=
options
[
:old_labels
]
||
[]
old_mentioned_users
=
options
[
:old_mentioned_users
]
||
[]
old_assignees
=
options
[
:old_assignees
]
||
[]
if
has_changes?
(
issue
,
old_labels:
old_labels
)
todo_service
.
mark_pending_todos_as_done
(
issue
,
current_user
)
end
...
...
app/services/merge_requests/assign_issues_service.rb
View file @
985f8b1a
...
...
@@ -14,7 +14,7 @@ module MergeRequests
def
execute
assignable_issues
.
each
do
|
issue
|
Issues
::
UpdateService
.
new
(
issue
.
project
,
current_user
,
assignee_ids:
[
current_user
.
id
]
).
execute
(
issue
)
Issues
::
UpdateService
.
new
(
issue
.
project
,
current_user
,
assignee_ids:
current_user
.
id
.
to_s
).
execute
(
issue
)
end
{
...
...
app/services/merge_requests/update_service.rb
View file @
985f8b1a
...
...
@@ -31,7 +31,10 @@ module MergeRequests
merge_request
end
def
handle_changes
(
merge_request
,
old_labels:
[],
old_mentioned_users:
[])
def
handle_changes
(
merge_request
,
options
)
old_labels
=
options
[
:old_labels
]
||
[]
old_mentioned_users
=
options
[
:old_mentioned_users
]
||
[]
if
has_changes?
(
merge_request
,
old_labels:
old_labels
)
todo_service
.
mark_pending_todos_as_done
(
merge_request
,
current_user
)
end
...
...
app/views/notify/_reassigned_issuable_email.text.erb
View file @
985f8b1a
...
...
@@ -2,5 +2,5 @@ Reassigned Issue <%= @issue.iid %>
<%=
url_for
([
@issue
.
project
.
namespace
.
becomes
(
Namespace
),
@issue
.
project
,
@issue
,
{
only_path:
false
}])
%>
Assignee changed
<%=
"from
#{
@previous_assignees
.
map
(
&
:name
)
}
"
if
@previous_assignees
.
any?
-%>
to
<%=
"
#{
@issue
.
assignees
.
any?
?
@issue
.
assignee
s
.
map
(
&
:name
)
:
'Unassigned'
}
"
%>
Assignee changed
<%=
"from
#{
@previous_assignees
.
map
(
&
:name
)
.
to_sentence
}
"
if
@previous_assignees
.
any?
-%>
to
<%=
"
#{
@issue
.
assignees
.
any?
?
@issue
.
assignee
_list
:
'Unassigned'
}
"
%>
app/views/notify/reassigned_issue_email.html.haml
View file @
985f8b1a
...
...
@@ -2,7 +2,7 @@
Assignee changed
-
if
@previous_assignees
.
any?
from
%strong
=
@previous_assignees
.
map
(
&
:
to_referenc
e
).
to_sentence
%strong
=
@previous_assignees
.
map
(
&
:
nam
e
).
to_sentence
to
-
if
@issue
.
assignees
.
any?
%strong
=
@issue
.
assignee_list
...
...
app/views/shared/issuable/form/_issue_assignee.html.haml
View file @
985f8b1a
...
...
@@ -26,5 +26,5 @@
assign yourself
.selectbox.hide-collapsed
=
f
.
hidden_field
'assignee_id
'
,
value:
issuable
.
assignee_id
,
id:
'issue_assignee_id
'
=
f
.
hidden_field
'assignee_id
s'
,
value:
issuable
.
assignee_ids
,
id:
'issue_assignee_ids
'
=
dropdown_tag
(
'Select assignee'
,
options:
{
toggle_class:
'js-user-search js-author-search'
,
title:
'Assign to'
,
filter:
true
,
dropdown_class:
'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author'
,
placeholder:
'Search users'
,
data:
{
first_user:
(
current_user
.
username
if
current_user
),
current_user:
true
,
project_id:
(
@project
.
id
if
@project
),
author_id:
issuable
.
author_id
,
field_name:
"
#{
issuable
.
to_ability_name
}
[assignee_id]"
,
issue_update:
issuable_json_path
(
issuable
),
ability_name:
issuable
.
to_ability_name
,
null_user:
true
}
})
app/views/shared/issuable/form/_metadata.html.haml
View file @
985f8b1a
...
...
@@ -10,13 +10,24 @@
.row
%div
{
class:
(
has_due_date
?
"col-lg-6"
:
"col-sm-12"
)
}
.form-group.issue-assignee
=
form
.
label
:assignee_id
,
"Assignee"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
.issuable-form-select-holder
=
form
.
hidden_field
:assignee_id
=
dropdown_tag
(
user_dropdown_label
(
issuable
.
assignee_id
,
"Assignee"
),
options:
{
toggle_class:
"js-dropdown-keep-input js-user-search js-issuable-form-dropdown js-assignee-search"
,
title:
"Select assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit"
,
placeholder:
"Search assignee"
,
data:
{
first_user:
current_user
.
try
(
:username
),
null_user:
true
,
current_user:
true
,
project_id:
issuable
.
project
.
try
(
:id
),
selected:
issuable
.
assignee_id
,
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[assignee_id]"
,
default_label:
"Assignee"
}
})
=
link_to
'Assign to me'
,
'#'
,
class:
"assign-to-me-link
#{
'hide'
if
issuable
.
assignee_id
==
current_user
.
id
}
"
-
if
issuable
.
is_a?
(
Issue
)
=
form
.
label
:assignee_ids
,
"Assignee"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
.issuable-form-select-holder
=
form
.
hidden_field
:assignee_ids
=
dropdown_tag
(
user_dropdown_label
(
issuable
.
assignee_ids
,
"Assignee"
),
options:
{
toggle_class:
"js-dropdown-keep-input js-user-search js-issuable-form-dropdown js-assignee-search"
,
title:
"Select assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit"
,
placeholder:
"Search assignee"
,
data:
{
first_user:
current_user
.
try
(
:username
),
null_user:
true
,
current_user:
true
,
project_id:
issuable
.
project
.
try
(
:id
),
selected:
issuable
.
assignee_ids
,
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[assignee_ids]"
,
default_label:
"Assignee"
}
})
=
link_to
'Assign to me'
,
'#'
,
class:
"assign-to-me-link
#{
'hide'
if
issuable
.
assignee_ids
.
split
(
', '
).
include?
(
current_user
.
id
)
}
"
-
else
=
form
.
label
:assignee_id
,
"Assignee"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
.issuable-form-select-holder
=
form
.
hidden_field
:assignee_id
=
dropdown_tag
(
user_dropdown_label
(
issuable
.
assignee_id
,
"Assignee"
),
options:
{
toggle_class:
"js-dropdown-keep-input js-user-search js-issuable-form-dropdown js-assignee-search"
,
title:
"Select assignee"
,
filter:
true
,
dropdown_class:
"dropdown-menu-user dropdown-menu-selectable dropdown-menu-assignee js-filter-submit"
,
placeholder:
"Search assignee"
,
data:
{
first_user:
current_user
.
try
(
:username
),
null_user:
true
,
current_user:
true
,
project_id:
issuable
.
project
.
try
(
:id
),
selected:
issuable
.
assignee_id
,
field_name:
"
#{
issuable
.
class
.
model_name
.
param_key
}
[assignee_id]"
,
default_label:
"Assignee"
}
})
=
link_to
'Assign to me'
,
'#'
,
class:
"assign-to-me-link
#{
'hide'
if
issuable
.
assignee_id
==
current_user
.
id
}
"
.form-group.issue-milestone
=
form
.
label
:milestone_id
,
"Milestone"
,
class:
"control-label
#{
"col-lg-4"
if
has_due_date
}
"
.col-sm-10
{
class:
(
"col-lg-8"
if
has_due_date
)
}
...
...
spec/features/boards/boards_spec.rb
View file @
985f8b1a
...
...
@@ -72,7 +72,7 @@ describe 'Issue Boards', feature: true, js: true do
let!
(
:list2
)
{
create
(
:list
,
board:
board
,
label:
development
,
position:
1
)
}
let!
(
:confidential_issue
)
{
create
(
:labeled_issue
,
:confidential
,
project:
project
,
author:
user
,
labels:
[
planning
],
relative_position:
9
)
}
let!
(
:issue1
)
{
create
(
:labeled_issue
,
project:
project
,
assignee
:
user
,
labels:
[
planning
],
relative_position:
8
)
}
let!
(
:issue1
)
{
create
(
:labeled_issue
,
project:
project
,
assignee
s:
[
user
]
,
labels:
[
planning
],
relative_position:
8
)
}
let!
(
:issue2
)
{
create
(
:labeled_issue
,
project:
project
,
author:
user2
,
labels:
[
planning
],
relative_position:
7
)
}
let!
(
:issue3
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
planning
],
relative_position:
6
)
}
let!
(
:issue4
)
{
create
(
:labeled_issue
,
project:
project
,
labels:
[
planning
],
relative_position:
5
)
}
...
...
spec/features/issues/filtered_search/filter_issues_spec.rb
View file @
985f8b1a
...
...
@@ -50,15 +50,15 @@ describe 'Filter issues', js: true, feature: true do
create
(
:issue
,
title:
"issue with 'single quotes'"
,
project:
project
)
create
(
:issue
,
title:
"issue with
\"
double quotes
\"
"
,
project:
project
)
create
(
:issue
,
title:
"issue with !@
\#
{$%^&*()-+"
,
project:
project
)
create
(
:issue
,
title:
"issue by assignee"
,
project:
project
,
milestone:
milestone
,
author:
user
,
assignee
:
user
)
create
(
:issue
,
title:
"issue by assignee with searchTerm"
,
project:
project
,
milestone:
milestone
,
author:
user
,
assignee
:
user
)
create
(
:issue
,
title:
"issue by assignee"
,
project:
project
,
milestone:
milestone
,
author:
user
,
assignee
s:
[
user
]
)
create
(
:issue
,
title:
"issue by assignee with searchTerm"
,
project:
project
,
milestone:
milestone
,
author:
user
,
assignee
s:
[
user
]
)
issue
=
create
(
:issue
,
title:
"Bug 2"
,
project:
project
,
milestone:
milestone
,
author:
user
,
assignee
:
user
)
assignee
s:
[
user
]
)
issue
.
labels
<<
bug_label
issue_with_caps_label
=
create
(
:issue
,
...
...
@@ -66,7 +66,7 @@ describe 'Filter issues', js: true, feature: true do
project:
project
,
milestone:
milestone
,
author:
user
,
assignee
:
user
)
assignee
s:
[
user
]
)
issue_with_caps_label
.
labels
<<
caps_sensitive_label
issue_with_everything
=
create
(
:issue
,
...
...
@@ -74,7 +74,7 @@ describe 'Filter issues', js: true, feature: true do
project:
project
,
milestone:
milestone
,
author:
user
,
assignee
:
user
)
assignee
s:
[
user
]
)
issue_with_everything
.
labels
<<
bug_label
issue_with_everything
.
labels
<<
caps_sensitive_label
...
...
spec/features/merge_requests/assign_issues_spec.rb
View file @
985f8b1a
...
...
@@ -33,7 +33,7 @@ feature 'Merge request issue assignment', js: true, feature: true do
end
it
"doesn't display if related issues are already assigned"
do
[
issue1
,
issue2
].
each
{
|
issue
|
issue
.
update!
(
assignee
:
user
)
}
[
issue1
,
issue2
].
each
{
|
issue
|
issue
.
update!
(
assignee
s:
[
user
]
)
}
visit_merge_request
...
...
spec/mailers/notify_spec.rb
View file @
985f8b1a
...
...
@@ -36,11 +36,11 @@ describe Notify do
end
context
'for issues'
do
let
(
:issue
)
{
create
(
:issue
,
author:
current_user
,
assignee
:
assignee
,
project:
project
)
}
let
(
:issue_with_description
)
{
create
(
:issue
,
author:
current_user
,
assignee
:
assignee
,
project:
project
,
description:
FFaker
::
Lorem
.
sentence
)
}
let
(
:issue
)
{
create
(
:issue
,
author:
current_user
,
assignee
s:
[
assignee
]
,
project:
project
)
}
let
(
:issue_with_description
)
{
create
(
:issue
,
author:
current_user
,
assignee
s:
[
assignee
]
,
project:
project
,
description:
FFaker
::
Lorem
.
sentence
)
}
describe
'that are new'
do
subject
{
Notify
.
new_issue_email
(
issue
.
assignee
_
id
,
issue
.
id
)
}
subject
{
Notify
.
new_issue_email
(
issue
.
assignee
s
.
first
.
id
,
issue
.
id
)
}
it_behaves_like
'an assignee email'
it_behaves_like
'an email starting a new thread with reply-by-email enabled'
do
...
...
@@ -70,7 +70,7 @@ describe Notify do
end
describe
'that are new with a description'
do
subject
{
Notify
.
new_issue_email
(
issue_with_description
.
assignee
_
id
,
issue_with_description
.
id
)
}
subject
{
Notify
.
new_issue_email
(
issue_with_description
.
assignee
s
.
first
.
id
,
issue_with_description
.
id
)
}
it_behaves_like
'it should show Gmail Actions View Issue link'
...
...
@@ -80,7 +80,7 @@ describe Notify do
end
describe
'that have been reassigned'
do
subject
{
Notify
.
reassigned_issue_email
(
recipient
.
id
,
issue
.
id
,
previous_assignee
.
id
,
current_user
.
id
)
}
subject
{
Notify
.
reassigned_issue_email
(
recipient
.
id
,
issue
.
id
,
[
previous_assignee
.
id
]
,
current_user
.
id
)
}
it_behaves_like
'a multiple recipients email'
it_behaves_like
'an answer to an existing thread with reply-by-email enabled'
do
...
...
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