diff --git a/src/webui/app/controllers/request_controller.rb b/src/webui/app/controllers/request_controller.rb index 04c0951..b82f35a 100644 --- a/src/webui/app/controllers/request_controller.rb +++ b/src/webui/app/controllers/request_controller.rb @@ -100,6 +100,21 @@ class RequestController < ApplicationController @diff_error, code, api_exception = ActiveXML::Transport.extract_error_message e logger.debug "Can't get diff for request: #{@diff_error}" end + + # search for mentions of bug IDs for integration with bugtrackers + descr=@req.value(:description) + @bugs_mentioned=[] + trackers=CONFIG['issuetrackers'] # from yml + unless trackers.nil? + # scan gives [["bnc", "123456"], ["bnc", "654321"], ["fate", "345678"]] + descr.scan(/(\w+)#(\d+)/).each do |type,bugid| + tracker=trackers[type] + next if tracker.nil? + @bugs_mentioned.push({:id=>bugid, :str=>"#{type}##{bugid}", :url=>tracker+bugid}) + #@bugs_mentioned.push({:id=>bugid, :str=>"#{type}##{bugid}", :url=>"https://bugzilla.novell.com/show_bug.cgi?id=#{bugid}"}) + end + end + end def change_request(changestate, params) diff --git a/src/webui/app/views/request/show.html.erb b/src/webui/app/views/request/show.html.erb index ca0cfe0..c27abb3 100644 --- a/src/webui/app/views/request/show.html.erb +++ b/src/webui/app/views/request/show.html.erb @@ -14,6 +14,10 @@ <% if @superseded_by %>

This request has been superseded by request #<%= link_to @superseded_by, :id => @superseded_by %>

<% end %> +<%= (@bugs_mentioned.map do |b| + "This request mentions #{b[:str]}
\n" + end).join("") +%>

Actions