diff --git a/lib/Exceptions.php b/lib/Exceptions.php index 112580de..c749780c 100644 --- a/lib/Exceptions.php +++ b/lib/Exceptions.php @@ -11,6 +11,15 @@ * @link https://github.com/rss-bridge/rss-bridge */ +/** + * Builds a GitHub search query to find open bugs for the current bridge + */ +function buildGitHubSearchQuery($bridgeName){ + return REPOSITORY + . 'issues?q=' + . urlencode('is:issue is:open ' . $bridgeName); +} + /** * Returns an URL that automatically populates a new issue on GitHub based * on the information provided @@ -84,6 +93,7 @@ function buildBridgeException($e, $bridge){ $body_html = nl2br($body); $link = buildGitHubIssueQuery($title, $body, 'Bridge-Broken', $bridge->getMaintainer()); + $searchQuery = buildGitHubSearchQuery($bridge::NAME); $header = buildHeader($e, $bridge); $message = << {$body_html} EOD; - $section = buildSection($e, $bridge, $message, $link); + $section = buildSection($e, $bridge, $message, $link, $searchQuery); return $section; } @@ -120,10 +130,11 @@ function buildTransformException($e, $bridge){ . '`'; $link = buildGitHubIssueQuery($title, $body, 'Bridge-Broken', $bridge->getMaintainer()); + $searchQuery = buildGitHubSearchQuery($bridge::NAME); $header = buildHeader($e, $bridge); $message = "RSS-Bridge was unable to transform the contents returned by {$bridge->getName()}!"; - $section = buildSection($e, $bridge, $message, $link); + $section = buildSection($e, $bridge, $message, $link, $searchQuery); return buildPage($title, $header, $section); } @@ -154,11 +165,12 @@ EOD; * @param object $bridge The bridge object * @param string $message The message to display * @param string $link The link to include in the anchor + * @param string $searchQuery A GitHub search query for the current bridge * @return string The HTML section * * @todo This function belongs inside a class */ -function buildSection($e, $bridge, $message, $link){ +function buildSection($e, $bridge, $message, $link, $searchQuery){ return <<

{$message}

@@ -166,9 +178,13 @@ function buildSection($e, $bridge, $message, $link){ + + +

{$bridge->getMaintainer()}