summaryrefslogtreecommitdiff
path: root/app/models/project.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 03:07:52 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-05 03:07:52 +0000
commita0c1ba61c8e8c9195e3ad4deefc5c4cb5c6a1501 (patch)
tree0731210fac047fdfb04a8e907701e0efab8c897e /app/models/project.rb
parent77237c5a6b9044f58beabc54d3589e5fa09cbfba (diff)
downloadgitlab-ce-a0c1ba61c8e8c9195e3ad4deefc5c4cb5c6a1501.tar.gz
Add latest changes from gitlab-org/gitlab@master
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')