summaryrefslogtreecommitdiff
path: root/app/services/projects/forks_count_service.rb
blob: dc6eb19affd8c23679c44f012a0a6a32e6ba3d4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
module Projects
  # Service class for getting and caching the number of forks of a project.
  class ForksCountService < Projects::CountService
    def cache_key_name
      'forks_count'
    end

    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)
    end
  end
end