Add support for close/reopen actions in update service

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-04-02 15:50:50 +03:00
parent cc77365488
commit ed67ba9663
No known key found for this signature in database
GPG key ID: 627C5F589F467F17
2 changed files with 11 additions and 2 deletions

View file

@ -3,7 +3,7 @@ module Issues
def execute(issue)
if issue.reopen
event_service.reopen_issue(issue, current_user)
create_note(issue, commit)
create_note(issue)
execute_hooks(issue)
end

View file

@ -1,7 +1,16 @@
module Issues
class UpdateService < BaseService
def execute(issue)
if issue.update_attributes(params)
state = params.delete('state_event')
case state
when 'reopen'
Issues::ReopenService.new(project, current_user, {}).execute(issue)
when 'close'
Issues::CloseService.new(project, current_user, {}).execute(issue)
end
if params.present? && issue.update_attributes(params)
issue.reset_events_cache
if issue.is_being_reassigned?