debian-mirror-gitlab/app/services/issues/create_service.rb

34 lines
736 B
Ruby
Raw Normal View History

2014-09-02 18:07:02 +05:30
module Issues
class CreateService < Issues::BaseService
def execute
2016-09-13 17:45:13 +05:30
@request = params.delete(:request)
@api = params.delete(:api)
2014-09-02 18:07:02 +05:30
2016-09-13 17:45:13 +05:30
@issue = project.issues.new
2014-09-02 18:07:02 +05:30
2016-09-13 17:45:13 +05:30
create(@issue)
end
def before_create(issuable)
issuable.spam = spam_service.check(@api)
end
def after_create(issuable)
event_service.open_issue(issuable, current_user)
notification_service.new_issue(issuable, current_user)
todo_service.new_issue(issuable, current_user)
user_agent_detail_service.create
end
private
def spam_service
SpamService.new(@issue, @request)
end
def user_agent_detail_service
UserAgentDetailService.new(@issue, @request)
2014-09-02 18:07:02 +05:30
end
end
end