Welcome to mirror list, hosted at ThFree Co, Russian Federation.

forks_count_service.rb « projects « services « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 00e7314835829738a0afbcb61ee3cd593a8580d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

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

    # rubocop: disable CodeReuse/ActiveRecord
    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
    # rubocop: enable CodeReuse/ActiveRecord
  end
end