f3fba178b9
This removes the `ForkedProjectLink` model that has been replaced by the `ForkNetworkMember` and `ForkNetwork` combination. All existing relations have been adjusted to use these new models. The `forked_project_link` table has been dropped. The "Forks" count on the admin dashboard has been updated to count all `ForkNetworkMember` rows and deduct the number of `ForkNetwork` rows. This is because now the "root-project" of a fork network also has a `ForkNetworkMember` row. This count could become inaccurate when the root of a fork network is deleted.
16 lines
431 B
Ruby
16 lines
431 B
Ruby
# 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)
|
|
ForkNetworkMember.where(forked_from_project: project_ids)
|
|
end
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
|
end
|
|
end
|