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
aba558a4
Commit
aba558a4
authored
Jul 18, 2016
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'caironoleto/gitlab-ce-cn-issue-19747'
parents
4b6e6d0a
36dc4a5c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
84 additions
and
8 deletions
+84
-8
CHANGELOG
CHANGELOG
+1
-0
app/assets/javascripts/issues-bulk-assignment.js.coffee
app/assets/javascripts/issues-bulk-assignment.js.coffee
+7
-6
app/assets/javascripts/subscription_select.js.coffee
app/assets/javascripts/subscription_select.js.coffee
+18
-0
app/controllers/projects/issues_controller.rb
app/controllers/projects/issues_controller.rb
+1
-0
app/services/issuable_base_service.rb
app/services/issuable_base_service.rb
+10
-0
app/services/issues/bulk_update_service.rb
app/services/issues/bulk_update_service.rb
+1
-1
app/views/shared/issuable/_filter.html.haml
app/views/shared/issuable/_filter.html.haml
+8
-1
spec/services/issues/bulk_update_service_spec.rb
spec/services/issues/bulk_update_service_spec.rb
+38
-0
No files found.
CHANGELOG
View file @
aba558a4
...
...
@@ -120,6 +120,7 @@ v 8.10.0 (unreleased)
- Limit the number of retries on error to 3 for exporting projects
- Allow empty repositories on project import/export
- Render only commit message title in builds (Katarzyna Kobierska Ula Budziszewska)
- Allow bulk (un)subscription from issues in issue index
v 8.9.6
- Fix importing of events under notes for GitLab projects. !5154
...
...
app/assets/javascripts/issues-bulk-assignment.js.coffee
View file @
aba558a4
...
...
@@ -85,12 +85,13 @@ class @IssuableBulkActions
getFormDataAsObject
:
->
formData
=
update
:
state_event
:
@
form
.
find
(
'input[name="update[state_event]"]'
).
val
()
assignee_id
:
@
form
.
find
(
'input[name="update[assignee_id]"]'
).
val
()
milestone_id
:
@
form
.
find
(
'input[name="update[milestone_id]"]'
).
val
()
issues_ids
:
@
form
.
find
(
'input[name="update[issues_ids]"]'
).
val
()
add_label_ids
:
[]
remove_label_ids
:
[]
state_event
:
@
form
.
find
(
'input[name="update[state_event]"]'
).
val
()
assignee_id
:
@
form
.
find
(
'input[name="update[assignee_id]"]'
).
val
()
milestone_id
:
@
form
.
find
(
'input[name="update[milestone_id]"]'
).
val
()
issues_ids
:
@
form
.
find
(
'input[name="update[issues_ids]"]'
).
val
()
subscription_event
:
@
form
.
find
(
'input[name="update[subscription_event]"]'
).
val
()
add_label_ids
:
[]
remove_label_ids
:
[]
if
@
willUpdateLabels
@
getLabelsToApply
().
map
(
id
)
->
...
...
app/assets/javascripts/subscription_select.js.coffee
0 → 100644
View file @
aba558a4
class
@
SubscriptionSelect
constructor
:
->
$
(
'.js-subscription-event'
).
each
(
i
,
el
)
->
fieldName
=
$
(
el
).
data
(
"field-name"
)
$
(
el
).
glDropdown
(
selectable
:
true
fieldName
:
fieldName
toggleLabel
:
(
selected
,
el
,
instance
)
=>
label
=
'Subscription'
$item
=
instance
.
dropdown
.
find
(
'.is-active'
)
label
=
$item
.
text
()
if
$item
.
length
label
clicked
:
(
item
,
$el
,
e
)
->
e
.
preventDefault
()
id
:
(
obj
,
el
)
->
$
(
el
).
data
(
"id"
)
)
app/controllers/projects/issues_controller.rb
View file @
aba558a4
...
...
@@ -226,6 +226,7 @@ class Projects::IssuesController < Projects::ApplicationController
:assignee_id
,
:milestone_id
,
:state_event
,
:subscription_event
,
label_ids:
[],
add_label_ids:
[],
remove_label_ids:
[]
...
...
app/services/issuable_base_service.rb
View file @
aba558a4
...
...
@@ -101,6 +101,7 @@ class IssuableBaseService < BaseService
def
update
(
issuable
)
change_state
(
issuable
)
change_subscription
(
issuable
)
filter_params
old_labels
=
issuable
.
labels
.
to_a
...
...
@@ -124,6 +125,15 @@ class IssuableBaseService < BaseService
end
end
def
change_subscription
(
issuable
)
case
params
.
delete
(
:subscription_event
)
when
'subscribe'
issuable
.
subscribe
(
current_user
)
when
'unsubscribe'
issuable
.
unsubscribe
(
current_user
)
end
end
def
has_changes?
(
issuable
,
old_labels:
[])
valid_attrs
=
[
:title
,
:description
,
:assignee_id
,
:milestone_id
,
:target_branch
]
...
...
app/services/issues/bulk_update_service.rb
View file @
aba558a4
...
...
@@ -4,7 +4,7 @@ module Issues
issues_ids
=
params
.
delete
(
:issues_ids
).
split
(
","
)
issue_params
=
params
%i(state_event milestone_id assignee_id add_label_ids remove_label_ids)
.
each
do
|
key
|
%i(state_event milestone_id assignee_id add_label_ids remove_label_ids
subscription_event
)
.
each
do
|
key
|
issue_params
.
delete
(
key
)
unless
issue_params
[
key
].
present?
end
...
...
app/views/shared/issuable/_filter.html.haml
View file @
aba558a4
...
...
@@ -44,9 +44,15 @@
placeholder:
"Search authors"
,
data:
{
first_user:
(
current_user
.
username
if
current_user
),
null_user:
true
,
current_user:
true
,
project_id:
@project
.
id
,
field_name:
"update[assignee_id]"
}
})
.filter-item.inline
=
dropdown_tag
(
"Milestone"
,
options:
{
title:
"Assign milestone"
,
toggle_class:
'js-milestone-select js-extra-options js-filter-submit js-filter-bulk-update'
,
filter:
true
,
dropdown_class:
"dropdown-menu-selectable dropdown-menu-milestone"
,
placeholder:
"Search milestones"
,
data:
{
show_no:
true
,
field_name:
"update[milestone_id]"
,
project_id:
@project
.
id
,
milestones:
namespace_project_milestones_path
(
@project
.
namespace
,
@project
,
:json
),
use_id:
true
}
})
.filter-item.inline.labels-filter
=
render
"shared/issuable/label_dropdown"
,
classes:
[
'js-filter-bulk-update'
,
'js-multiselect'
],
show_create:
false
,
show_footer:
false
,
extra_options:
false
,
filter_submit:
false
,
show_footer:
false
,
data_options:
{
persist_when_hide:
"true"
,
field_name:
"update[label_ids][]"
,
show_no:
false
,
show_any:
false
,
use_id:
true
}
.filter-item.inline
=
dropdown_tag
(
"Subscription"
,
options:
{
toggle_class:
"js-subscription-event"
,
title:
"Change subscription"
,
dropdown_class:
"dropdown-menu-selectable"
,
data:
{
field_name:
"update[subscription_event]"
}
}
)
do
%ul
%li
%a
{
href:
"#"
,
data:
{
id:
"subscribe"
}}
Subscribe
%li
%a
{
href:
"#"
,
data:
{
id:
"unsubscribe"
}}
Unsubscribe
=
hidden_field_tag
'update[issues_ids]'
,
[]
=
hidden_field_tag
:state_event
,
params
[
:state_event
]
...
...
@@ -63,6 +69,7 @@
new
LabelsSelect
();
new
MilestoneSelect
();
new
IssueStatusSelect
();
new
SubscriptionSelect
();
$
(
'
form.filter-form
'
).
on
(
'
submit
'
,
function
(
event
)
{
event
.
preventDefault
();
Turbolinks
.
visit
(
this
.
action
+
'
&
'
+
$
(
this
).
serialize
());
...
...
spec/services/issues/bulk_update_service_spec.rb
View file @
aba558a4
...
...
@@ -262,4 +262,42 @@ describe Issues::BulkUpdateService, services: true do
end
end
end
describe
:subscribe_issues
do
let
(
:issues
)
{
create_list
(
:issue
,
5
,
project:
project
)
}
let
(
:params
)
do
{
subscription_event:
'subscribe'
,
issues_ids:
issues
.
map
(
&
:id
).
join
(
','
)
}
end
it
'subscribes the given user'
do
issues
.
each
do
|
issue
|
expect
(
issue
.
subscribed?
(
user
)).
to
be_truthy
end
end
end
describe
:unsubscribe_issues
do
let
(
:issues
)
{
create_list
(
:closed_issue
,
5
,
project:
project
)
}
let
(
:params
)
do
{
subscription_event:
'unsubscribe'
,
issues_ids:
issues
.
map
(
&
:id
).
join
(
','
)
}
end
before
do
issues
.
each
do
|
issue
|
issue
.
subscriptions
.
create
(
user:
user
,
subscribed:
true
)
end
end
it
'unsubscribes the given user'
do
issues
.
each
do
|
issue
|
expect
(
issue
.
subscribed?
(
user
)).
to
be_falsey
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