summaryrefslogtreecommitdiff
path: root/app/models/lfs_object.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-08 15:06:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-08 15:06:21 +0000
commit759bab058520a21d87087355dc193f634176e98a (patch)
treec26bdab0be782b6852e5f588dc5f1b056c2eec56 /app/models/lfs_object.rb
parent61f0c58946ebac453b55a657cd4be1ac50a01e11 (diff)
downloadgitlab-ce-759bab058520a21d87087355dc193f634176e98a.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/lfs_object.rb')
-rw-r--r--app/models/lfs_object.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/lfs_object.rb b/app/models/lfs_object.rb
index 535c3cf2ba1..48c971194c6 100644
--- a/app/models/lfs_object.rb
+++ b/app/models/lfs_object.rb
@@ -18,6 +18,11 @@ class LfsObject < ApplicationRecord
after_save :update_file_store, if: :saved_change_to_file?
+ def self.not_linked_to_project(project)
+ where('NOT EXISTS (?)',
+ project.lfs_objects_projects.select(1).where('lfs_objects_projects.lfs_object_id = lfs_objects.id'))
+ end
+
def update_file_store
# The file.object_store is set during `uploader.store!`
# which happens after object is inserted/updated