summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/project.rb')
-rw-r--r--app/models/project.rb19
1 files changed, 15 insertions, 4 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index b0a1e378b41..dd0a6c0de0d 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -1398,12 +1398,17 @@ class Project < ApplicationRecord
.where(lfs_objects_projects: { project_id: [self, lfs_storage_project] })
end
- # TODO: Call `#lfs_objects` instead once all LfsObjectsProject records are
- # backfilled. At that point, projects can look at their own `lfs_objects`.
+ # TODO: Remove this method once all LfsObjectsProject records are backfilled
+ # for forks. At that point, projects can look at their own `lfs_objects` so
+ # `lfs_objects_oids` can be used instead.
#
# See https://gitlab.com/gitlab-org/gitlab/issues/122002 for more info.
- def lfs_objects_oids
- all_lfs_objects.pluck(:oid)
+ def all_lfs_objects_oids(oids: [])
+ oids(all_lfs_objects, oids: oids)
+ end
+
+ def lfs_objects_oids(oids: [])
+ oids(lfs_objects, oids: oids)
end
def personal?
@@ -2515,6 +2520,12 @@ class Project < ApplicationRecord
reset
retry
end
+
+ def oids(objects, oids: [])
+ collection = oids.any? ? objects.where(oid: oids) : objects
+
+ collection.pluck(:oid)
+ end
end
Project.prepend_if_ee('EE::Project')