2014-04-02 06:38:35 -04:00
|
|
|
module Issues
|
2014-04-02 12:55:23 -04:00
|
|
|
class CreateService < Issues::BaseService
|
2016-03-18 09:48:55 -04:00
|
|
|
def execute
|
2015-06-25 10:17:48 -04:00
|
|
|
filter_params
|
2014-07-30 15:48:21 -04:00
|
|
|
label_params = params[:label_ids]
|
|
|
|
issue = project.issues.new(params.except(:label_ids))
|
2016-03-18 09:48:55 -04:00
|
|
|
issue.author = params[:author] || current_user
|
2014-04-02 06:38:35 -04:00
|
|
|
|
|
|
|
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)
|
2016-02-20 08:59:59 -05:00
|
|
|
todo_service.new_issue(issue, current_user)
|
2014-04-02 06:38:35 -04:00
|
|
|
event_service.open_issue(issue, current_user)
|
2015-10-12 05:54:46 -04:00
|
|
|
issue.create_cross_references!(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
|