2018-07-17 12:50:37 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-08-14 09:22:09 -04:00
|
|
|
module Projects
|
|
|
|
# Service class for getting and caching the number of forks of a project.
|
2017-11-15 09:47:10 -05:00
|
|
|
class ForksCountService < Projects::CountService
|
2017-08-17 11:21:25 -04:00
|
|
|
def cache_key_name
|
|
|
|
'forks_count'
|
2017-08-14 09:22:09 -04:00
|
|
|
end
|
2017-11-30 06:52:38 -05:00
|
|
|
|
|
|
|
def self.query(project_ids)
|
2017-11-30 16:17:17 -05:00
|
|
|
# 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-11-30 06:52:38 -05:00
|
|
|
end
|
2017-08-14 09:22:09 -04:00
|
|
|
end
|
|
|
|
end
|