gitlab-org--gitlab-foss/app/services/issues/reopen_service.rb
Rémy Coutable a54fdc384f Enforce permissions in {Issues,MergeRequests}::{Close,Reopen}Service
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-08-13 00:06:11 +02:00

22 lines
538 B
Ruby

module Issues
class ReopenService < Issues::BaseService
def execute(issue)
return issue unless can?(current_user, :update_issue, issue)
if issue.reopen
event_service.reopen_issue(issue, current_user)
create_note(issue)
notification_service.reopen_issue(issue, current_user)
execute_hooks(issue, 'reopen')
end
issue
end
private
def create_note(issue)
SystemNoteService.change_status(issue, issue.project, current_user, issue.state, nil)
end
end
end