2014-04-02 06:38:35 -04:00
|
|
|
module Issues
|
2014-04-02 12:55:23 -04:00
|
|
|
class CreateService < Issues::BaseService
|
2014-04-02 06:38:35 -04:00
|
|
|
def execute
|
2014-07-30 15:48:21 -04:00
|
|
|
label_params = params[:label_ids]
|
|
|
|
issue = project.issues.new(params.except(:label_ids))
|
2014-04-02 06:38:35 -04:00
|
|
|
issue.author = current_user
|
|
|
|
|
|
|
|
if issue.save
|
2014-07-30 15:48:21 -04:00
|
|
|
issue.update_attributes(label_ids: label_params)
|
2014-04-02 06:38:35 -04:00
|
|
|
notification_service.new_issue(issue, current_user)
|
|
|
|
event_service.open_issue(issue, current_user)
|
|
|
|
issue.create_cross_references!(issue.project, current_user)
|
2014-05-23 09:16:03 -04:00
|
|
|
execute_hooks(issue, 'open')
|
2014-04-02 06:38:35 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
issue
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|