Skip to content

Commit

Permalink
Use patchinfo from target package for accepted requests
Browse files Browse the repository at this point in the history
The source project for maintenance release requests gets
deleted in many cases after it is accepted. Therefore we
have to fetch the patchinfo from the target in those cases.
We also should handle the case of a removed source and target
to prevent nil exceptions.

Fixes openSUSE#16030
  • Loading branch information
krauselukas committed Apr 23, 2024
1 parent d847aac commit 48025f2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/api/app/views/webui/request/_patchinfo_details.html.haml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#patchinfo-details
%h4.my-3 Patches
- bs_request.bs_request_actions.where(source_package: 'patchinfo').each do |patchinfo|
- patchinfo_package = Package.find_by_project_and_name(patchinfo.source_project, patchinfo.source_package)
- patchinfo_text = patchinfo_package.source_file('_patchinfo', rev: patchinfo.source_rev || patchinfo_package.rev)
= render PatchinfoComponent.new(patchinfo_text, request_changes_path(number: bs_request.number, request_action_id: patchinfo.id))
- patchinfo_source_package = Package.find_by_project_and_name(patchinfo.source_project, patchinfo.source_package)
- patchinfo_target_package = Package.find_by_project_and_name(patchinfo.target_project, patchinfo.target_package)
- if patchinfo_source_package.present?
- patchinfo_text = patchinfo_source_package.source_file('_patchinfo', rev: patchinfo.source_rev || patchinfo_package.rev)
= render PatchinfoComponent.new(patchinfo_text, request_changes_path(number: bs_request.number, request_action_id: patchinfo.id))
- elsif patchinfo.bs_request_action_accept_info.present? && patchinfo_target_package.present?
- patchinfo_text = patchinfo_target_package.source_file('_patchinfo', rev: patchinfo.bs_request_action_accept_info.rev)
= render PatchinfoComponent.new(patchinfo_text, request_changes_path(number: bs_request.number, request_action_id: patchinfo.id))
- else
%p The source and target of #{patchinfo.target_project}/#{patchinfo.target_package} does not exist anymore.

0 comments on commit 48025f2

Please sign in to comment.