debian-mirror-gitlab/app/services/projects/forks_count_service.rb

16 lines
516 B
Ruby
Raw Normal View History

2017-09-10 17:25:29 +05:30
module Projects
# Service class for getting and caching the number of forks of a project.
2018-03-17 18:26:18 +05:30
class ForksCountService < Projects::CountService
def cache_key_name
'forks_count'
2017-09-10 17:25:29 +05:30
end
2018-03-17 18:26:18 +05:30
def self.query(project_ids)
# We can't directly change ForkedProjectLink to ForkNetworkMember here
# Nowadays, when a call using v3 to projects/:id/fork is made,
# the relationship to ForkNetworkMember is not updated
ForkedProjectLink.where(forked_from_project: project_ids)
2017-09-10 17:25:29 +05:30
end
end
end