summaryrefslogtreecommitdiff
path: root/app/controllers/repositories
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-07 12:09:13 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-07 12:09:13 +0000
commit211a8c3361ccf4eb92f36edbdcf15c98fcdcc8b7 (patch)
tree0ad37172721a39b0d57240bb1b4e70f200a0d93e /app/controllers/repositories
parent456a7247f9e88fc2518b69a1a00e905c6db6d775 (diff)
downloadgitlab-ce-211a8c3361ccf4eb92f36edbdcf15c98fcdcc8b7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/repositories')
-rw-r--r--app/controllers/repositories/lfs_storage_controller.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/app/controllers/repositories/lfs_storage_controller.rb b/app/controllers/repositories/lfs_storage_controller.rb
index 58f496e16d3..ec5ca5bbeec 100644
--- a/app/controllers/repositories/lfs_storage_controller.rb
+++ b/app/controllers/repositories/lfs_storage_controller.rb
@@ -80,12 +80,13 @@ module Repositories
LfsObject.create!(oid: oid, size: size, file: uploaded_file)
end
- # rubocop: disable CodeReuse/ActiveRecord
def link_to_project!(object)
- if object && !object.projects.exists?(storage_project.id)
- object.lfs_objects_projects.create!(project: storage_project)
- end
+ return unless object
+
+ LfsObjectsProject.safe_find_or_create_by!(
+ project: project,
+ lfs_object: object
+ )
end
- # rubocop: enable CodeReuse/ActiveRecord
end
end