Skip to content

Commit

Permalink
[webui] Directly use parameters
Browse files Browse the repository at this point in the history
Adding parameters into variables that are only used once is kinda
pointless. Let's change this.
  • Loading branch information
bgeuken committed Jul 27, 2015
1 parent 8f820d0 commit c41bea5
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions src/api/app/controllers/webui/patchinfo_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,6 @@ def save
end

if valid_params
packager = params[:packager]
binaries = params[:selected_binaries]
relogin = params[:relogin]
reboot = params[:reboot]
zypp_restart_needed = params[:zypp_restart_needed]
if params[:issueid]
issues = []
params[:issueid].each_with_index do |new_issue, index|
Expand All @@ -134,19 +129,18 @@ def save
issues << issue
end
end
rating = params[:rating]
node = Builder::XmlMarkup.new(indent: 2)
attrs = {}
attrs[:incident] = @package.project.name.gsub(/.*:/, '')
xml = node.patchinfo(attrs) do |n|
if binaries
binaries.each do |binary|
if params[:selected_binaries]
params[:selected_binaries].each do |binary|
if !binary.blank?
node.binary(binary)
end
end
end
node.packager packager
node.packager params[:packager]
if issues
issues.each do |issue|
unless IssueTracker.find_by_name(issue[1])
Expand All @@ -157,16 +151,16 @@ def save
end
end
node.category params[:category]
node.rating rating
node.rating params[:rating]
node.summary params[:summary]
node.description params[:description].gsub("\r\n", "\n")
if reboot
if params[:reboot]
node.reboot_needed
end
if relogin
if params[:relogin]
node.relogin_needed
end
if zypp_restart_needed
if params[:zypp_restart_needed]
node.zypp_restart_needed
end
if params[:block] == 'true'
Expand Down

0 comments on commit c41bea5

Please sign in to comment.