Commit 3527d1ff authored by Francisco Lopez's avatar Francisco Lopez

Undoing the change to ForkNetworkMember

parent fe95de88
...@@ -10,7 +10,10 @@ module Projects ...@@ -10,7 +10,10 @@ module Projects
end end
def self.query(project_ids) 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 end
end end
...@@ -163,9 +163,7 @@ module API ...@@ -163,9 +163,7 @@ module API
expose :lfs_enabled?, as: :lfs_enabled expose :lfs_enabled?, as: :lfs_enabled
expose :creator_id expose :creator_id
expose :namespace, using: 'API::Entities::NamespaceBasic' expose :namespace, using: 'API::Entities::NamespaceBasic'
expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda { |project, options| project.forked? } do |project, options| expose :forked_from_project, using: Entities::BasicProjectDetails, if: lambda { |project, options| project.forked? }
project.fork_network_member.forked_from_project
end
expose :import_status expose :import_status
expose :import_error, if: lambda { |_project, options| options[:user_can_admin_project] } expose :import_error, if: lambda { |_project, options| options[:user_can_admin_project] }
...@@ -184,17 +182,15 @@ module API ...@@ -184,17 +182,15 @@ module API
expose :statistics, using: 'API::Entities::ProjectStatistics', if: :statistics expose :statistics, using: 'API::Entities::ProjectStatistics', if: :statistics
def self.preload_relation(projects_relation, options = {}) def self.preload_relation(projects_relation, options = {})
relation = super(projects_relation).preload(:group) super(projects_relation).preload(:group)
.preload(project_group_links: :group, .preload(project_group_links: :group,
fork_network: :root_project, fork_network: :root_project,
fork_network_member: [forked_from_project: [:route, namespace: :route, tags: :taggings]]) forked_project_link: :forked_from_project,
forked_from_project: [:route, :forks, 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)
end end
def self.forks_counting_projects(projects_relation) 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
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment