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
123bdad1
Commit
123bdad1
authored
Jan 24, 2018
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Execute group hooks after-commit when moving an issue
parent
62e04169
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
4 deletions
+27
-4
changelogs/unreleased-ee/dm-issue-move-transaction-error-ee.yml
...logs/unreleased-ee/dm-issue-move-transaction-error-ee.yml
+5
-0
ee/app/models/ee/project.rb
ee/app/models/ee/project.rb
+4
-2
spec/services/issues/move_service_spec.rb
spec/services/issues/move_service_spec.rb
+18
-2
No files found.
changelogs/unreleased-ee/dm-issue-move-transaction-error-ee.yml
0 → 100644
View file @
123bdad1
---
title
:
Execute group hooks after-commit when moving an issue
merge_request
:
author
:
type
:
fixed
ee/app/models/ee/project.rb
View file @
123bdad1
...
...
@@ -268,8 +268,10 @@ module EE
super
if
group
&&
feature_available?
(
:group_webhooks
)
group
.
hooks
.
__send__
(
hooks_scope
).
each
do
|
hook
|
# rubocop:disable GitlabSecurity/PublicSend
hook
.
async_execute
(
data
,
hooks_scope
.
to_s
)
run_after_commit_or_now
do
group
.
hooks
.
hooks_for
(
hooks_scope
).
each
do
|
hook
|
hook
.
async_execute
(
data
,
hooks_scope
.
to_s
)
end
end
end
end
...
...
spec/services/issues/move_service_spec.rb
View file @
123bdad1
...
...
@@ -6,7 +6,7 @@ describe Issues::MoveService do
let
(
:title
)
{
'Some issue'
}
let
(
:description
)
{
'Some issue description'
}
let
(
:old_project
)
{
create
(
:project
)
}
let
(
:new_project
)
{
create
(
:project
)
}
let
(
:new_project
)
{
create
(
:project
,
group:
create
(
:group
)
)
}
let
(
:milestone1
)
{
create
(
:milestone
,
project_id:
old_project
.
id
,
title:
'v9.0'
)
}
let
(
:old_issue
)
do
...
...
@@ -297,9 +297,25 @@ describe Issues::MoveService do
end
context
'project issue hooks'
do
let
(
:hook
)
{
create
(
:project_hook
,
project:
old_project
,
issues_events:
true
)
}
let
!
(
:hook
)
{
create
(
:project_hook
,
project:
old_project
,
issues_events:
true
)
}
it
'executes project issue hooks'
do
allow_any_instance_of
(
WebHookService
).
to
receive
(
:execute
)
# Ideally, we'd test that `WebHookWorker.jobs.size` increased by 1,
# but since the entire spec run takes place in a transaction, we never
# actually get to the `after_commit` hook that queues these jobs.
expect
{
move_service
.
execute
(
old_issue
,
new_project
)
}
.
not_to
raise_error
# Sidekiq::Worker::EnqueueFromTransactionError
end
end
context
'group issue hooks'
do
let!
(
:hook
)
{
create
(
:group_hook
,
group:
new_project
.
group
,
issues_events:
true
)
}
it
'executes group issue hooks'
do
allow_any_instance_of
(
WebHookService
).
to
receive
(
:execute
)
# Ideally, we'd test that `WebHookWorker.jobs.size` increased by 1,
# but since the entire spec run takes place in a transaction, we never
# actually get to the `after_commit` hook that queues these jobs.
...
...
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