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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
cc773654
Commit
cc773654
authored
Apr 02, 2014
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create services for issue close and reopen
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
0d41f6f0
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
10 deletions
+43
-10
app/services/git_push_service.rb
app/services/git_push_service.rb
+3
-4
app/services/issues/base_service.rb
app/services/issues/base_service.rb
+0
-5
app/services/issues/close_service.rb
app/services/issues/close_service.rb
+20
-0
app/services/issues/reopen_service.rb
app/services/issues/reopen_service.rb
+19
-0
app/services/issues/update_service.rb
app/services/issues/update_service.rb
+1
-1
No files found.
app/services/git_push_service.rb
View file @
cc773654
...
...
@@ -86,10 +86,9 @@ class GitPushService
author
=
commit_user
(
commit
)
if
!
issues_to_close
.
empty?
&&
is_default_branch
Thread
.
current
[
:current_user
]
=
author
Thread
.
current
[
:current_commit
]
=
commit
issues_to_close
.
each
{
|
i
|
i
.
close
&&
i
.
save
}
issues_to_close
.
each
do
|
issue
|
Issues
::
CloseService
.
new
(
project
,
author
,
{}).
execute
(
issue
,
commit
)
end
end
# Create cross-reference notes for any other references. Omit any issues that were referenced in an
...
...
app/services/issues/base_service.rb
View file @
cc773654
...
...
@@ -3,11 +3,6 @@ module Issues
private
# Create issue note with service comment like 'Status changed to closed'
def
create_note
(
issue
)
Note
.
create_status_change_note
(
issue
,
issue
.
project
,
current_user
,
issue
.
state
,
current_commit
)
end
def
create_assignee_note
(
issue
)
Note
.
create_assignee_change_note
(
issue
,
issue
.
project
,
current_user
,
issue
.
assignee
)
end
...
...
app/services/issues/close_service.rb
0 → 100644
View file @
cc773654
module
Issues
class
CloseService
<
BaseService
def
execute
(
issue
,
commit
=
nil
)
if
issue
.
close
notification_service
.
close_issue
(
issue
,
current_user
)
event_service
.
close_issue
(
issue
,
current_user
)
create_note
(
issue
,
commit
)
execute_hooks
(
issue
)
end
issue
end
private
def
create_note
(
issue
,
current_commit
)
Note
.
create_status_change_note
(
issue
,
issue
.
project
,
current_user
,
issue
.
state
,
current_commit
)
end
end
end
app/services/issues/reopen_service.rb
0 → 100644
View file @
cc773654
module
Issues
class
ReopenService
<
BaseService
def
execute
(
issue
)
if
issue
.
reopen
event_service
.
reopen_issue
(
issue
,
current_user
)
create_note
(
issue
,
commit
)
execute_hooks
(
issue
)
end
issue
end
private
def
create_note
(
issue
)
Note
.
create_status_change_note
(
issue
,
issue
.
project
,
current_user
,
issue
.
state
,
nil
)
end
end
end
app/services/issues/update_service.rb
View file @
cc773654
...
...
@@ -5,7 +5,7 @@ module Issues
issue
.
reset_events_cache
if
issue
.
is_being_reassigned?
notification
.
reassigned_issue
(
issue
,
current_user
)
notification
_service
.
reassigned_issue
(
issue
,
current_user
)
create_assignee_note
(
issue
)
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