Commit cf60e782 authored by Stan Hu's avatar Stan Hu

Merge branch '338947-remove-safe-find-or-create-by-in-create-package-service' into 'master'

CreatePackageService: remove `safe_find_or_create_by!` call

See merge request gitlab-org/gitlab!68859
parents 187a4495 84e7ea12
...@@ -5,15 +5,19 @@ module Packages ...@@ -5,15 +5,19 @@ module Packages
protected protected
def find_or_create_package!(package_type, name: params[:name], version: params[:version]) def find_or_create_package!(package_type, name: params[:name], version: params[:version])
# safe_find_or_create_by! was originally called here.
# We merely switched to `find_or_create_by!`
# rubocop: disable CodeReuse/ActiveRecord
project project
.packages .packages
.with_package_type(package_type) .with_package_type(package_type)
.safe_find_or_create_by!(name: name, version: version) do |package| .find_or_create_by!(name: name, version: version) do |package|
package.status = params[:status] if params[:status] package.status = params[:status] if params[:status]
package.creator = package_creator package.creator = package_creator
add_build_info(package) add_build_info(package)
end end
# rubocop: enable CodeReuse/ActiveRecord
end end
def create_package!(package_type, attrs = {}) def create_package!(package_type, attrs = {})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment