Skip to content

Commit

Permalink
Merge pull request #15096 from hennevogel/refactoring/expand_all_proj…
Browse files Browse the repository at this point in the history
…ects

Switch allow_remote_projects default
  • Loading branch information
hennevogel committed Oct 23, 2023
2 parents 6ad031a + aab43da commit 32125ce
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/api/app/models/concerns/project_links.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def validate_link_xml_attribute(request_data, project_name)
end

def expand_linking_to
expand_all_projects(allow_remote_projects: false).map(&:id)
expand_all_projects.map(&:id)
end

def expand_all_projects(project_map: {}, allow_remote_projects: true)
def expand_all_projects(project_map: {}, allow_remote_projects: false)
# cycle check
return [] if project_map[self]

Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/concerns/project_maintenance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def maintained_project_names
end

def expand_maintained_projects
maintained_projects.collect { |mp| mp.project.expand_all_projects(allow_remote_projects: false) }.flatten
maintained_projects.collect { |mp| mp.project.expand_all_projects }.flatten
end

def is_maintenance_release?
Expand Down
4 changes: 2 additions & 2 deletions src/api/app/models/owner_search/assignee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def lookup_package_owner(package)
return package_owner if package_owner

# no match, loop about projects below with this package container name
package.project.expand_all_projects(allow_remote_projects: false).each do |project|
package.project.expand_all_projects.each do |project|
project_package = project.packages.find_by_name(package.name)
next if project_package.nil? || @already_checked[project_package.id]

Expand Down Expand Up @@ -114,7 +114,7 @@ def parse_binary_info(binary, project)
end

def find_assignees(binary_name)
projects = @rootproject.expand_all_projects(allow_remote_projects: false)
projects = @rootproject.expand_all_projects

# binary search via all projects
data = Xmlhash.parse(Backend::Api::Search.binary(projects.map(&:name), binary_name))
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/owner_search/missing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def find
owners = []
# search in each marked project
projects_to_look_at.each do |project|
@projects = project.expand_all_projects(allow_remote_projects: false)
@projects = project.expand_all_projects
@roles = filter(project).map { |f| Role.find_by_title!(f) }

(all_packages - defined_packages).each do |p|
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/owner_search/owned.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def for(owner)
# search in each marked project
projects_to_look_at.map do |project|
@roles = filter(project).map { |f| Role.find_by_title!(f) }
@projects = project.expand_all_projects(allow_remote_projects: false)
@projects = project.expand_all_projects
find_projects(project, owner)
find_packages(project, owner)
end
Expand Down
2 changes: 1 addition & 1 deletion src/api/app/models/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ def self.get_by_project_and_name(project, package, opts = {})
if pkg.nil? && opts[:follow_project_links]
# in case we link to a remote project we need to assume that the
# backend may be able to find it even when we don't have the package local
prj.expand_all_projects.each do |p|
prj.expand_all_projects(allow_remote_projects: true).each do |p|
return nil unless p.is_a?(Project)
end
end
Expand Down

0 comments on commit 32125ce

Please sign in to comment.