Skip to content

Commit

Permalink
[webui] Several fixes for the patchinfo display
Browse files Browse the repository at this point in the history
- Fixed TrackerNotFound-error in the patchinfo-show if a wrong issue-tracker-format is uploaded
- Show CVE-foo-bar instead of CVE#CVE-foo-bar in patchinfo-show
  • Loading branch information
bbrunner authored and coolo committed Nov 29, 2012
1 parent ae32ece commit 77c270a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
8 changes: 7 additions & 1 deletion src/webui/app/controllers/patchinfo_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,13 @@ def read_patchinfo
if @file.has_element?("issue")
@file.each_issue do |a|
if a.text == ""
get_issue_sum(a.tracker, a.value(:id))
# old uploaded patchinfos could have broken tracker-names like "bnc " instead of "bnc". Catch these.
begin
get_issue_sum(a.tracker, a.value(:id))
a.text = @issuesum
rescue ActiveXML::Transport::NotFoundError
a.text = "PLEASE CHECK THE FORMAT OF THE ISSUE"
end
end
issue = Array.new
issueid = a.value(:id)
Expand Down
15 changes: 15 additions & 0 deletions src/webui/app/helpers/patchinfo_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,19 @@ def patchinfo_bread_crumb( *args )
args.insert(0, link_to( @package, :action => :show, :project => @project, :package => @package ))
project_bread_crumb( *args )
end

def issue_link( issue )

# list issue-names with urls and summary from the patchinfo-file
# issue[0] = tracker-name
# issue[1] = issueid
# issue[2] = issue-url
# issue[3] = issue-summary

if issue[0] == "CVE"
content_tag(:li, link_to("#{issue[1]}", issue[2]) + ": #{issue[3]}")
else
content_tag(:li, link_to("#{issue[0]}##{issue[1]}", issue[2]) + ": #{issue[3]}")
end
end
end
13 changes: 8 additions & 5 deletions src/webui/app/views/patchinfo/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@
<%= description_wrapper(@description) %>
</div>
<div class="box show_left show_right">
<b>Fixed bugs:</b><br/>
<% @issues.each do |issue| %>
<%= link_to("#{issue[0].to_s}##{issue[1].to_s}", issue[2].to_s)%>: <%= issue[3].to_s %>
<br/>
<%end%>
<b>Fixed bugs:</b>
<% unless @issues.blank? %>
<ul>
<% @issues.each do |issue| %>
<%= issue_link(issue) %>
<% end %>
</ul>
<% end %>
</div>
<div class="box show_left show_right">
<b>Required actions:</b><br/>
Expand Down

0 comments on commit 77c270a

Please sign in to comment.