Commit: 3210ab0d11bf5411ba1bf223e0deb5270d735f05 Author: Nikita Popov <[email protected]> Thu, 22 Dec 2016 00:17:46 +0100 Parents: 8724f9674722fed9060c044d5df6504f4db8d4ff Branches: master
Link: http://git.php.net/?p=web/master.git;a=commitdiff;h=3210ab0d11bf5411ba1bf223e0deb5270d735f05 Log: Show "Issue" instead of "Pull Request" in a few more places Changed paths: M github-webhook.php Diff: diff --git a/github-webhook.php b/github-webhook.php index b1e7210..c6480eb 100644 --- a/github-webhook.php +++ b/github-webhook.php @@ -19,10 +19,14 @@ function get_repo_email($repos, $repoName) { return $to; } +function is_pr($issue) { + return strpos($issue->html_url, '/pull/') !== false; +} + function prep_title($issue, $repoName) { $issueNumber = $issue->number; $title = $issue->title; - $type = strpos($issue->html_url, '/pull/') !== false ? 'PR' : 'Issue'; + $type = is_pr($issue) ? 'PR' : 'Issue'; $subject = sprintf('[%s][%s #%s] - %s', $repoName, $type, $issueNumber, $title); @@ -64,13 +68,14 @@ switch ($event) { $to = get_repo_email($CONFIG["repos"], $repoName); $subject = prep_title($issue, $repoName); + $type = is_pr($issue) ? 'Pull Request' : 'Issue'; - $message = sprintf("You can view the Pull Request on github:\r\n%s", $htmlUrl); + $message = sprintf("You can view the %s on github:\r\n%s", $type, $htmlUrl); switch ($action) { case 'opened': $message .= sprintf( - "\r\n\r\nOpened By: %s\r\nPull Request Description:\r\n%s", - $username, $description); + "\r\n\r\nOpened By: %s\r\n%s Description:\r\n%s", + $type, $username, $description); break; case 'closed': $message .= "\r\n\r\nClosed."; @@ -104,7 +109,9 @@ switch ($event) { $to = get_repo_email($CONFIG["repos"], $repoName); $subject = prep_title($issue, $repoName); - $message = sprintf("You can view the Pull Request on github:\r\n%s", $htmlUrl); + $type = is_pr($issue) ? 'Pull Request' : 'Issue'; + + $message = sprintf("You can view the %s on github:\r\n%s", $type, $htmlUrl); switch ($action) { case 'created': $message .= sprintf("\r\n\r\nComment by %s:\r\n%s", $username, $comment); -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
