Skip to content

Commit

Permalink
Display multibuild flavors when asking for local project sources
Browse files Browse the repository at this point in the history
There was a consistency gap between sources coming from local projects
and sources coming from remote projects. Multibuild flavors were only
shown for remote projects. Now the multibuild flavors are shown in both
cases.

Fixes openSUSE#16911
  • Loading branch information
danidoni committed Oct 8, 2024
1 parent 40ac3f8 commit 645ca77
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/api/app/controllers/source_project_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class SourceProjectController < SourceController
# GET /source/:project
def show
project_name = params[:project]
if params[:deleted] == '1'
if params[:deleted] == '0'
unless Project.find_by_name(project_name) || Project.is_remote_project?(project_name)
# project is deleted or not accessible
validate_visibility_of_deleted_project(project_name)
Expand All @@ -22,6 +22,11 @@ def show
@project = Project.find_by_name(project_name)
raise Project::UnknownObjectError, "Project not found: #{project_name}" unless @project

if @project.scmsync.present? || params[:deleted] == '1'
pass_to_backend
return
end

# we let the backend list the packages after we verified the project is visible
if params.key?(:view)
case params[:view]
Expand Down Expand Up @@ -52,7 +57,8 @@ def render_project_issues
end

def render_project_packages
@packages = params.key?(:expand) ? @project.expand_all_packages : @project.packages.pluck(:name)
# TODO: Display multibuild flavors when passing the expand param
@packages = params.key?(:expand) ? @project.expand_all_packages : @project.packages.sort_by(&:name)
render locals: { expand: params.key?(:expand) }, formats: [:xml]
end

Expand Down
11 changes: 8 additions & 3 deletions src/api/app/views/source_project/show.xml.builder
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
xml.directory(count: @packages.count) do
@packages.map do |name, project|
@packages.map do |package, project|
if expand
xml.entry(name: name, originproject: project)
xml.entry(name: package, originproject: project)
elsif package.multibuild?
xml.entry(name: package.name)
package.multibuild_flavors.each do |flavor|
xml.entry(name: "#{package.name}:#{flavor}", originpackage: package.name)
end
else
xml.entry(name: name)
xml.entry(name: package)
end
end
end

0 comments on commit 645ca77

Please sign in to comment.