summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancisco Lopez <fjlopez@gitlab.com>2017-11-30 22:17:17 +0100
committerFrancisco Lopez <fjlopez@gitlab.com>2017-12-01 18:32:12 +0100
commit3527d1ff2bc06ba38e820b300e49f817d2833379 (patch)
tree78f0bb13e8388249c27b49d6273dc8810a0bbdfd
parentfe95de88551bd3c8d22591764d948205f9fbc10e (diff)
downloadgitlab-ce-3527d1ff2bc06ba38e820b300e49f817d2833379.tar.gz
Undoing the change to ForkNetworkMember
-rw-r--r--app/services/projects/forks_count_service.rb5
-rw-r--r--lib/api/entities.rb18
2 files changed, 11 insertions, 12 deletions
diff --git a/app/services/projects/forks_count_service.rb b/app/services/projects/forks_count_service.rb
index d67ae78b268..95ce655b157 100644
--- a/app/services/projects/forks_count_service.rb
+++ b/app/services/projects/forks_count_service.rb
@@ -10,7 +10,10 @@ module Projects
end
def self.query(project_ids)
- ForkNetworkMember.where(forked_from_project: 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
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index d224f468c18..7cec8da013d 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -163,9 +163,7 @@ module API
expose :lfs_enabled?, as: :lfs_enabled
expose :creator_id
expose :namespace, using: 'API::Entities::NamespaceBasic'
- expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda { |project, options| project.forked? } do |project, options|
- project.fork_network_member.forked_from_project
- end
+ expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda { |project, options| project.forked? }
expose :import_status
expose :import_error, if: lambda { |_project, options| options[:user_can_admin_project] }
@@ -184,17 +182,15 @@ module API
expose :statistics, using: 'API::Entities::ProjectStatistics', if: :statistics
def self.preload_relation(projects_relation, options = {})
- relation = super(projects_relation).preload(:group)
- .preload(project_group_links: :group,
- fork_network: :root_project,
- fork_network_member: [forked_from_project: [:route, namespace: :route, tags: :taggings]])
-
- # Remove this preload once forked_project_links and forked_from_project models have been removed
- relation.preload(forked_project_link: :forked_from_project)
+ super(projects_relation).preload(:group)
+ .preload(project_group_links: :group,
+ fork_network: :root_project,
+ forked_project_link: :forked_from_project,
+ forked_from_project: [:route, :forks, namespace: :route, tags: :taggings])
end
def self.forks_counting_projects(projects_relation)
- projects_relation + projects_relation.map(&:fork_network_member).compact.map(&:forked_from_project).compact
+ projects_relation + projects_relation.map(&:forked_from_project).compact
end
end