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
|
2016-07-30 00:18:32 -04:00
|
|
|
@request = params.delete(:request)
|
|
|
|
@api = params.delete(:api)
|
2014-04-02 06:38:35 -04:00
|
|
|
|
2016-08-16 18:49:53 -04:00
|
|
|
@issue = project.issues.new
|
2016-07-18 19:17:43 -04:00
|
|
|
|
2016-08-16 18:49:53 -04:00
|
|
|
create(@issue)
|
2016-06-30 11:34:19 -04:00
|
|
|
end
|
2014-04-02 06:38:35 -04:00
|
|
|
|
2016-08-16 20:59:55 -04:00
|
|
|
def before_create(issuable)
|
|
|
|
issuable.spam = spam_service.check(@api)
|
|
|
|
end
|
|
|
|
|
|
|
|
def after_create(issuable)
|
2016-06-30 11:34:19 -04:00
|
|
|
event_service.open_issue(issuable, current_user)
|
|
|
|
notification_service.new_issue(issuable, current_user)
|
|
|
|
todo_service.new_issue(issuable, current_user)
|
2016-08-16 18:49:53 -04:00
|
|
|
user_agent_detail_service.create
|
2014-04-02 06:38:35 -04:00
|
|
|
end
|
2016-07-21 19:11:53 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
2016-08-05 18:10:08 -04:00
|
|
|
def spam_service
|
2016-08-09 13:43:47 -04:00
|
|
|
SpamService.new(@issue, @request)
|
2016-07-21 19:11:53 -04:00
|
|
|
end
|
2016-07-27 20:03:06 -04:00
|
|
|
|
2016-07-30 00:18:32 -04:00
|
|
|
def user_agent_detail_service
|
|
|
|
UserAgentDetailService.new(@issue, @request)
|
2016-07-21 19:11:53 -04:00
|
|
|
end
|
2014-04-02 06:38:35 -04:00
|
|
|
end
|
|
|
|
end
|