Skip to content

Commit

Permalink
[webui] Get rid of ActiveXML in PatchinfoController#get_issue_sum
Browse files Browse the repository at this point in the history
  • Loading branch information
hennevogel committed Nov 5, 2015
1 parent 9856f5f commit 191e26c
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/api/app/controllers/webui/patchinfo_controller.rb
Expand Up @@ -274,22 +274,24 @@ def get_issue_sum(tracker, issueid)
else
bug = issueid
end
path = "/issue_trackers/#{CGI.escape(tracker)}"
tracker_result = ActiveXML::Node.new(frontend.transport.direct_http(URI(path), method: 'GET'))
if bug.match(/^#{tracker_result.value(:regex)}$/)
begin
path << "/issues/#{CGI.escape(issueid)}"
result = ActiveXML::Node.new(frontend.transport.direct_http(URI(path), method: 'GET'))
unless result.value(:summary)
path << "?force_update=1"
result = ActiveXML::Node.new(frontend.transport.direct_http(URI(path), method: 'GET'))
end
return (result.value(:summary) || '').gsub(/\\|'/) { '' }
# Add no summary if a connection to bugzilla doesn't work e.g. in the testsuite
rescue ActiveXML::Transport::Error
return ""

issue_tracker = IssueTracker.find_by(name: tracker)
return nil unless issue_tracker

if bug.match(/^#{issue_tracker.regex}$/)
issue = Issue.find_or_create_by_name_and_tracker( issueid, issue_tracker.name )
if issue && issue.summary.blank?
issue.fetch_updates
end
if issue.summary
return issue.summary.gsub(/\\|'/) { '' }
else
return ''
end
else
return nil
end
return ''
end

private
Expand Down

0 comments on commit 191e26c

Please sign in to comment.