diff --git a/app/services/issues/create_service.rb b/app/services/issues/create_service.rb index 6d05d417f1b..d5c17906a55 100644 --- a/app/services/issues/create_service.rb +++ b/app/services/issues/create_service.rb @@ -1,10 +1,12 @@ module Issues class CreateService < Issues::BaseService def execute - issue = project.issues.new(params) + label_params = params[:label_ids] + issue = project.issues.new(params.except(:label_ids)) issue.author = current_user if issue.save + issue.update_attributes(label_ids: label_params) notification_service.new_issue(issue, current_user) event_service.open_issue(issue, current_user) issue.create_cross_references!(issue.project, current_user) diff --git a/app/services/merge_requests/create_service.rb b/app/services/merge_requests/create_service.rb index d1bf827f3fc..ca8d80f6c0c 100644 --- a/app/services/merge_requests/create_service.rb +++ b/app/services/merge_requests/create_service.rb @@ -1,12 +1,14 @@ module MergeRequests class CreateService < MergeRequests::BaseService def execute - merge_request = MergeRequest.new(params) + label_params = params[:label_ids] + merge_request = MergeRequest.new(params.except(:label_ids)) merge_request.source_project = project merge_request.target_project ||= project merge_request.author = current_user if merge_request.save + merge_request.update_attributes(label_ids: label_params) event_service.open_mr(merge_request, current_user) notification_service.new_merge_request(merge_request, current_user) merge_request.create_cross_references!(merge_request.project, current_user)