From 7cfc87bbe65e7bf4dcbeb7143669adc662442869 Mon Sep 17 00:00:00 2001 From: epriestley Date: Thu, 24 Mar 2016 05:55:11 -0700 Subject: [PATCH] Improve rendering of many GitHub event strings Summary: Ref T10538. This makes us render better human-readable descriptions of more GitHub event types. Test Plan: Ran unit tests. Reviewers: chad Reviewed By: chad Maniphest Tasks: T10538 Differential Revision: https://secure.phabricator.com/D15516 --- .../nuance/github/NuanceGitHubRawEvent.php | 172 ++++++++++++++++++ .../NuanceGitHubRawEventTestCase.php | 1 + .../github/__tests__/issueevents/assigned.txt | 3 +- .../github/__tests__/issueevents/closed.txt | 3 +- .../__tests__/issueevents/demilestoned.txt | 3 +- .../github/__tests__/issueevents/labeled.txt | 3 +- .../github/__tests__/issueevents/locked.txt | 3 +- .../__tests__/issueevents/milestoned.txt | 3 +- .../github/__tests__/issueevents/renamed.txt | 3 +- .../github/__tests__/issueevents/reopened.txt | 3 +- .../__tests__/issueevents/unassigned.txt | 3 +- .../__tests__/issueevents/unlabeled.txt | 3 +- .../github/__tests__/issueevents/unlocked.txt | 3 +- .../repositoryevents/CreateEvent.tag.txt | 37 ++++ .../IssueCommentEvent.created.pull.txt | 3 +- .../IssueCommentEvent.created.txt | 3 +- .../repositoryevents/IssuesEvent.closed.txt | 3 +- .../repositoryevents/IssuesEvent.opened.txt | 3 +- .../repositoryevents/IssuesEvent.reopened.txt | 3 +- .../PullRequestEvent.opened.txt | 3 +- .../__tests__/repositoryevents/PushEvent.txt | 3 +- .../repositoryevents/WatchEvent.started.txt | 3 +- .../nuance/item/NuanceGitHubEventItemType.php | 54 +----- 23 files changed, 249 insertions(+), 72 deletions(-) create mode 100644 src/applications/nuance/github/__tests__/repositoryevents/CreateEvent.tag.txt diff --git a/src/applications/nuance/github/NuanceGitHubRawEvent.php b/src/applications/nuance/github/NuanceGitHubRawEvent.php index 2c0d62c7ca..1283fb43b7 100644 --- a/src/applications/nuance/github/NuanceGitHubRawEvent.php +++ b/src/applications/nuance/github/NuanceGitHubRawEvent.php @@ -125,6 +125,11 @@ final class NuanceGitHubRawEvent extends Phobject { } } else { switch ($this->getIssueRawKind()) { + case 'CreateEvent': + $ref = idxv($raw, array('payload', 'ref')); + + $repo = $this->getRepositoryFullRawName(); + return "https://github.com/{$repo}/commits/{$ref}"; case 'PushEvent': // These don't really have a URI since there may be multiple commits // involved and GitHub doesn't bundle the push as an object on its @@ -205,4 +210,171 @@ final class NuanceGitHubRawEvent extends Phobject { return idxv($raw, array('payload', 'issue', 'pull_request')); } + public function getEventFullTitle() { + switch ($this->type) { + case self::TYPE_ISSUE: + $title = $this->getRawIssueEventTitle(); + break; + case self::TYPE_REPOSITORY: + $title = $this->getRawRepositoryEventTitle(); + break; + default: + $title = pht('Unknown Event Type ("%s")', $this->type); + break; + } + + return pht( + 'GitHub %s %s (%s)', + $this->getRepositoryFullRawName(), + $this->getTargetObjectName(), + $title); + } + + private function getTargetObjectName() { + if ($this->isPullRequestEvent()) { + $number = $this->getRawIssueNumber(); + return pht('Pull Request #%d', $number); + } else if ($this->isIssueEvent()) { + $number = $this->getRawIssueNumber(); + return pht('Issue #%d', $number); + } else if ($this->type == self::TYPE_REPOSITORY) { + $raw = $this->raw; + + + $type = idx($raw, 'type'); + switch ($type) { + case 'CreateEvent': + $ref = idxv($raw, array('payload', 'ref')); + $ref_type = idxv($raw, array('payload', 'ref_type')); + + switch ($ref_type) { + case 'branch': + return pht('Branch %s', $ref); + case 'tag': + return pht('Tag %s', $ref); + default: + return pht('Ref %s', $ref); + } + break; + case 'PushEvent': + $ref = idxv($raw, array('payload', 'ref')); + if (preg_match('(^refs/heads/)', $ref)) { + return pht('Branch %s', substr($ref, strlen('refs/heads/'))); + } else { + return pht('Ref %s', $ref); + } + break; + case 'WatchEvent': + $actor = idxv($raw, array('actor', 'login')); + return pht('User %s', $actor); + } + + return pht('Unknown Object'); + } else { + return pht('Unknown Object'); + } + } + + private function getRawIssueEventTitle() { + $raw = $this->raw; + + $action = idxv($raw, array('event')); + switch ($action) { + case 'assigned': + $assignee = idxv($raw, array('assignee', 'login')); + $title = pht('Assigned: %s', $assignee); + break; + case 'closed': + $title = pht('Closed'); + break; + case 'demilestoned': + $milestone = idxv($raw, array('milestone', 'title')); + $title = pht('Removed Milestone: %s', $milestone); + break; + case 'labeled': + $label = idxv($raw, array('label', 'name')); + $title = pht('Added Label: %s', $label); + break; + case 'locked': + $title = pht('Locked'); + break; + case 'milestoned': + $milestone = idxv($raw, array('milestone', 'title')); + $title = pht('Added Milestone: %s', $milestone); + break; + case 'renamed': + $title = pht('Renamed'); + break; + case 'reopened': + $title = pht('Reopened'); + break; + case 'unassigned': + $assignee = idxv($raw, array('assignee', 'login')); + $title = pht('Unassigned: %s', $assignee); + break; + case 'unlabeled': + $label = idxv($raw, array('label', 'name')); + $title = pht('Removed Label: %s', $label); + break; + case 'unlocked': + $title = pht('Unlocked'); + break; + default: + $title = pht('"%s"', $action); + break; + } + + + return $title; + } + + private function getRawRepositoryEventTitle() { + $raw = $this->raw; + + $type = idx($raw, 'type'); + switch ($type) { + case 'CreateEvent': + return pht('Created'); + case 'PushEvent': + $head = idxv($raw, array('payload', 'head')); + $head = substr($head, 0, 12); + return pht('Pushed: %s', $head); + case 'IssuesEvent': + $action = idxv($raw, array('payload', 'action')); + switch ($action) { + case 'closed': + return pht('Closed'); + case 'opened': + return pht('Created'); + case 'reopened': + return pht('Reopened'); + default: + return pht('"%s"', $action); + } + break; + case 'IssueCommentEvent': + $action = idxv($raw, array('payload', 'action')); + switch ($action) { + case 'created': + return pht('Comment'); + default: + return pht('"%s"', $action); + } + break; + case 'PullRequestEvent': + $action = idxv($raw, array('payload', 'action')); + switch ($action) { + case 'opened': + return pht('Created'); + default: + return pht('"%s"', $action); + } + break; + case 'WatchEvent': + return pht('Watched'); + } + + return pht('"%s"', $type); + } + } diff --git a/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php b/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php index 5ce199cb8c..f5e2119141 100644 --- a/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php +++ b/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php @@ -50,6 +50,7 @@ final class NuanceGitHubRawEventTestCase 'pull.number' => $event->getPullRequestNumber(), 'id' => $event->getID(), 'uri' => $event->getURI(), + 'title.full' => $event->getEventFullTitle(), ); // Only verify the keys which are actually present in the test. This diff --git a/src/applications/nuance/github/__tests__/issueevents/assigned.txt b/src/applications/nuance/github/__tests__/issueevents/assigned.txt index 7c1c89435f..a126186b19 100644 --- a/src/applications/nuance/github/__tests__/issueevents/assigned.txt +++ b/src/applications/nuance/github/__tests__/issueevents/assigned.txt @@ -112,5 +112,6 @@ "is.pull": false, "issue.number": 1, "id": 583217900, - "uri": "https://github.com/epriestley/poems/issues/1#event-583217900" + "uri": "https://github.com/epriestley/poems/issues/1#event-583217900", + "title.full": "GitHub epriestley/poems Issue #1 (Assigned: epriestley)" } diff --git a/src/applications/nuance/github/__tests__/issueevents/closed.txt b/src/applications/nuance/github/__tests__/issueevents/closed.txt index e13c9a1ffd..6428fc6bcb 100644 --- a/src/applications/nuance/github/__tests__/issueevents/closed.txt +++ b/src/applications/nuance/github/__tests__/issueevents/closed.txt @@ -74,5 +74,6 @@ "is.pull": false, "issue.number": 1, "id": 583218864, - "uri": "https://github.com/epriestley/poems/issues/1#event-583218864" + "uri": "https://github.com/epriestley/poems/issues/1#event-583218864", + "title.full": "GitHub epriestley/poems Issue #1 (Closed)" } diff --git a/src/applications/nuance/github/__tests__/issueevents/demilestoned.txt b/src/applications/nuance/github/__tests__/issueevents/demilestoned.txt index 1c9bab5725..5c32ec6c6c 100644 --- a/src/applications/nuance/github/__tests__/issueevents/demilestoned.txt +++ b/src/applications/nuance/github/__tests__/issueevents/demilestoned.txt @@ -77,5 +77,6 @@ "is.pull": false, "issue.number": 1, "id": 583218613, - "uri": "https://github.com/epriestley/poems/issues/1#event-583218613" + "uri": "https://github.com/epriestley/poems/issues/1#event-583218613", + "title.full": "GitHub epriestley/poems Issue #1 (Removed Milestone: b)" } diff --git a/src/applications/nuance/github/__tests__/issueevents/labeled.txt b/src/applications/nuance/github/__tests__/issueevents/labeled.txt index 92cd7cd4f0..bb88a13b9a 100644 --- a/src/applications/nuance/github/__tests__/issueevents/labeled.txt +++ b/src/applications/nuance/github/__tests__/issueevents/labeled.txt @@ -78,5 +78,6 @@ "is.pull": false, "issue.number": 1, "id": 583217784, - "uri": "https://github.com/epriestley/poems/issues/1#event-583217784" + "uri": "https://github.com/epriestley/poems/issues/1#event-583217784", + "title.full": "GitHub epriestley/poems Issue #1 (Added Label: bug)" } diff --git a/src/applications/nuance/github/__tests__/issueevents/locked.txt b/src/applications/nuance/github/__tests__/issueevents/locked.txt index 536d95af8e..7eafd9e906 100644 --- a/src/applications/nuance/github/__tests__/issueevents/locked.txt +++ b/src/applications/nuance/github/__tests__/issueevents/locked.txt @@ -74,5 +74,6 @@ "is.pull": false, "issue.number": 1, "id": 583218006, - "uri": "https://github.com/epriestley/poems/issues/1#event-583218006" + "uri": "https://github.com/epriestley/poems/issues/1#event-583218006", + "title.full": "GitHub epriestley/poems Issue #1 (Locked)" } diff --git a/src/applications/nuance/github/__tests__/issueevents/milestoned.txt b/src/applications/nuance/github/__tests__/issueevents/milestoned.txt index 748beddda9..3e5a6a4590 100644 --- a/src/applications/nuance/github/__tests__/issueevents/milestoned.txt +++ b/src/applications/nuance/github/__tests__/issueevents/milestoned.txt @@ -77,5 +77,6 @@ "is.pull": false, "issue.number": 1, "id": 583217866, - "uri": "https://github.com/epriestley/poems/issues/1#event-583217866" + "uri": "https://github.com/epriestley/poems/issues/1#event-583217866", + "title.full": "GitHub epriestley/poems Issue #1 (Added Milestone: b)" } diff --git a/src/applications/nuance/github/__tests__/issueevents/renamed.txt b/src/applications/nuance/github/__tests__/issueevents/renamed.txt index e4a4614ebb..08a3c0c448 100644 --- a/src/applications/nuance/github/__tests__/issueevents/renamed.txt +++ b/src/applications/nuance/github/__tests__/issueevents/renamed.txt @@ -78,5 +78,6 @@ "is.pull": false, "issue.number": 1, "id": 583218162, - "uri": "https://github.com/epriestley/poems/issues/1#event-583218162" + "uri": "https://github.com/epriestley/poems/issues/1#event-583218162", + "title.full": "GitHub epriestley/poems Issue #1 (Renamed)" } diff --git a/src/applications/nuance/github/__tests__/issueevents/reopened.txt b/src/applications/nuance/github/__tests__/issueevents/reopened.txt index baab332450..26d5b3ec75 100644 --- a/src/applications/nuance/github/__tests__/issueevents/reopened.txt +++ b/src/applications/nuance/github/__tests__/issueevents/reopened.txt @@ -74,5 +74,6 @@ "is.pull": false, "issue.number": 1, "id": 583218814, - "uri": "https://github.com/epriestley/poems/issues/1#event-583218814" + "uri": "https://github.com/epriestley/poems/issues/1#event-583218814", + "title.full": "GitHub epriestley/poems Issue #1 (Reopened)" } diff --git a/src/applications/nuance/github/__tests__/issueevents/unassigned.txt b/src/applications/nuance/github/__tests__/issueevents/unassigned.txt index 43c610b576..086401afa7 100644 --- a/src/applications/nuance/github/__tests__/issueevents/unassigned.txt +++ b/src/applications/nuance/github/__tests__/issueevents/unassigned.txt @@ -112,5 +112,6 @@ "is.pull": false, "issue.number": 1, "id": 583218511, - "uri": "https://github.com/epriestley/poems/issues/1#event-583218511" + "uri": "https://github.com/epriestley/poems/issues/1#event-583218511", + "title.full": "GitHub epriestley/poems Issue #1 (Unassigned: epriestley)" } diff --git a/src/applications/nuance/github/__tests__/issueevents/unlabeled.txt b/src/applications/nuance/github/__tests__/issueevents/unlabeled.txt index 8d40ba5702..dde464ab15 100644 --- a/src/applications/nuance/github/__tests__/issueevents/unlabeled.txt +++ b/src/applications/nuance/github/__tests__/issueevents/unlabeled.txt @@ -78,5 +78,6 @@ "is.pull": false, "issue.number": 1, "id": 583218703, - "uri": "https://github.com/epriestley/poems/issues/1#event-583218703" + "uri": "https://github.com/epriestley/poems/issues/1#event-583218703", + "title.full": "GitHub epriestley/poems Issue #1 (Removed Label: bug)" } diff --git a/src/applications/nuance/github/__tests__/issueevents/unlocked.txt b/src/applications/nuance/github/__tests__/issueevents/unlocked.txt index 080fbd79e8..580a6170bb 100644 --- a/src/applications/nuance/github/__tests__/issueevents/unlocked.txt +++ b/src/applications/nuance/github/__tests__/issueevents/unlocked.txt @@ -74,5 +74,6 @@ "is.pull": false, "issue.number": 1, "id": 583218062, - "uri": "https://github.com/epriestley/poems/issues/1#event-583218062" + "uri": "https://github.com/epriestley/poems/issues/1#event-583218062", + "title.full": "GitHub epriestley/poems Issue #1 (Unlocked)" } diff --git a/src/applications/nuance/github/__tests__/repositoryevents/CreateEvent.tag.txt b/src/applications/nuance/github/__tests__/repositoryevents/CreateEvent.tag.txt new file mode 100644 index 0000000000..f0a8a3a1ad --- /dev/null +++ b/src/applications/nuance/github/__tests__/repositoryevents/CreateEvent.tag.txt @@ -0,0 +1,37 @@ +{ + "id": "3784548642", + "type": "CreateEvent", + "actor": { + "id": 102631, + "login": "epriestley", + "gravatar_id": "", + "url": "https://api.github.com/users/epriestley", + "avatar_url": "https://avatars.githubusercontent.com/u/102631?" + }, + "repo": { + "id": 14627834, + "name": "epriestley/poems", + "url": "https://api.github.com/repos/epriestley/poems" + }, + "payload": { + "ref": "phabricator/diff/400", + "ref_type": "tag", + "master_branch": "master", + "description": "Poems (Mirror)", + "pusher_type": "user" + }, + "public": true, + "created_at": "2016-03-19T22:07:56Z" +} + +~~~~~ +{ + "repository.name.full": "epriestley/poems", + "is.issue": false, + "is.pull": false, + "issue.number": null, + "pull.number": null, + "id": 3784548642, + "uri": "https://github.com/epriestley/poems/commits/phabricator/diff/400", + "title.full": "GitHub epriestley/poems Tag phabricator/diff/400 (Created)" +} diff --git a/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.pull.txt b/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.pull.txt index 7b3e7d3708..71abbceac4 100644 --- a/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.pull.txt +++ b/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.pull.txt @@ -159,5 +159,6 @@ "issue.number": null, "pull.number": 2, "id": 3740938746, - "uri": "https://github.com/epriestley/poems/pull/2#issuecomment-194282800" + "uri": "https://github.com/epriestley/poems/pull/2#issuecomment-194282800", + "title.full": "GitHub epriestley/poems Pull Request #2 (Comment)" } diff --git a/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.txt b/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.txt index acb40f0971..a1ca094045 100644 --- a/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.txt +++ b/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.txt @@ -96,5 +96,6 @@ "is.pull": false, "issue.number": 1, "id": 3733510485, - "uri": "https://github.com/epriestley/poems/issues/1#issuecomment-193528669" + "uri": "https://github.com/epriestley/poems/issues/1#issuecomment-193528669", + "title.full": "GitHub epriestley/poems Issue #1 (Comment)" } diff --git a/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.closed.txt b/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.closed.txt index 78fc81be95..6e7d743303 100644 --- a/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.closed.txt +++ b/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.closed.txt @@ -68,5 +68,6 @@ "is.pull": false, "issue.number": 1, "id": 3740905151, - "uri": "https://github.com/epriestley/poems/issues/1#event-3740905151" + "uri": "https://github.com/epriestley/poems/issues/1#event-3740905151", + "title.full": "GitHub epriestley/poems Issue #1 (Closed)" } diff --git a/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.opened.txt b/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.opened.txt index 7ba07a591b..0b42f723d5 100644 --- a/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.opened.txt +++ b/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.opened.txt @@ -68,5 +68,6 @@ "is.pull": false, "issue.number": 1, "id": 3733509737, - "uri": "https://github.com/epriestley/poems/issues/1#event-3733509737" + "uri": "https://github.com/epriestley/poems/issues/1#event-3733509737", + "title.full": "GitHub epriestley/poems Issue #1 (Created)" } diff --git a/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.reopened.txt b/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.reopened.txt index 797eb84078..3a0c5b7a20 100644 --- a/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.reopened.txt +++ b/src/applications/nuance/github/__tests__/repositoryevents/IssuesEvent.reopened.txt @@ -68,5 +68,6 @@ "is.pull": false, "issue.number": 1, "id": 3740908680, - "uri": "https://github.com/epriestley/poems/issues/1#event-3740908680" + "uri": "https://github.com/epriestley/poems/issues/1#event-3740908680", + "title.full": "GitHub epriestley/poems Issue #1 (Reopened)" } diff --git a/src/applications/nuance/github/__tests__/repositoryevents/PullRequestEvent.opened.txt b/src/applications/nuance/github/__tests__/repositoryevents/PullRequestEvent.opened.txt index c2f892f090..f80649e724 100644 --- a/src/applications/nuance/github/__tests__/repositoryevents/PullRequestEvent.opened.txt +++ b/src/applications/nuance/github/__tests__/repositoryevents/PullRequestEvent.opened.txt @@ -332,5 +332,6 @@ "issue.number": null, "pull.number": 2, "id": 3740936638, - "uri": "https://github.com/epriestley/poems/pull/2#event-3740936638" + "uri": "https://github.com/epriestley/poems/pull/2#event-3740936638", + "title.full": "GitHub epriestley/poems Pull Request #2 (Created)" } diff --git a/src/applications/nuance/github/__tests__/repositoryevents/PushEvent.txt b/src/applications/nuance/github/__tests__/repositoryevents/PushEvent.txt index d7c1b5ecad..c6ecf1bdbc 100644 --- a/src/applications/nuance/github/__tests__/repositoryevents/PushEvent.txt +++ b/src/applications/nuance/github/__tests__/repositoryevents/PushEvent.txt @@ -43,5 +43,6 @@ "is.pull": false, "issue.number": null, "id": 3498724127, - "uri": "https://github.com/epriestley/poems/commits/c829132d37c4c1da80d319942a5a1e500632b52f" + "uri": "https://github.com/epriestley/poems/commits/c829132d37c4c1da80d319942a5a1e500632b52f", + "title.full": "GitHub epriestley/poems Branch master (Pushed: c829132d37c4)" } diff --git a/src/applications/nuance/github/__tests__/repositoryevents/WatchEvent.started.txt b/src/applications/nuance/github/__tests__/repositoryevents/WatchEvent.started.txt index c65a5ee771..c23678f448 100644 --- a/src/applications/nuance/github/__tests__/repositoryevents/WatchEvent.started.txt +++ b/src/applications/nuance/github/__tests__/repositoryevents/WatchEvent.started.txt @@ -27,5 +27,6 @@ "issue.number": null, "pull.number": null, "id": 3740950917, - "uri": null + "uri": null, + "title.full": "GitHub epriestley/poems User epriestley (Watched)" } diff --git a/src/applications/nuance/item/NuanceGitHubEventItemType.php b/src/applications/nuance/item/NuanceGitHubEventItemType.php index 1c6d90bbf3..2bccfb76b4 100644 --- a/src/applications/nuance/item/NuanceGitHubEventItemType.php +++ b/src/applications/nuance/item/NuanceGitHubEventItemType.php @@ -16,59 +16,7 @@ final class NuanceGitHubEventItemType } public function getItemDisplayName(NuanceItem $item) { - $api_type = $item->getItemProperty('api.type'); - switch ($api_type) { - case 'issue': - return $this->getGitHubIssueAPIEventDisplayName($item); - case 'repository': - return $this->getGitHubRepositoryAPIEventDisplayName($item); - default: - return pht('GitHub Event (Unknown API Type "%s")', $api_type); - } - } - - private function getGitHubIssueAPIEventDisplayName(NuanceItem $item) { - $raw = $item->getItemProperty('api.raw', array()); - - $action = idxv($raw, array('event')); - $number = idxv($raw, array('issue', 'number')); - - return pht('GitHub Issue #%d (%s)', $number, $action); - } - - private function getGitHubRepositoryAPIEventDisplayName(NuanceItem $item) { - $raw = $item->getItemProperty('api.raw', array()); - - $repo = idxv($raw, array('repo', 'name'), pht('')); - - $type = idx($raw, 'type'); - switch ($type) { - case 'PushEvent': - $head = idxv($raw, array('payload', 'head')); - $head = substr($head, 0, 8); - $name = pht('Push %s', $head); - break; - case 'IssuesEvent': - $action = idxv($raw, array('payload', 'action')); - $number = idxv($raw, array('payload', 'issue', 'number')); - $name = pht('Issue #%d (%s)', $number, $action); - break; - case 'IssueCommentEvent': - $action = idxv($raw, array('payload', 'action')); - $number = idxv($raw, array('payload', 'issue', 'number')); - $name = pht('Issue #%d (Comment, %s)', $number, $action); - break; - case 'PullRequestEvent': - $action = idxv($raw, array('payload', 'action')); - $number = idxv($raw, array('payload', 'pull_request', 'number')); - $name = pht('Pull Request #%d (%s)', $number, $action); - break; - default: - $name = pht('Unknown Event ("%s")', $type); - break; - } - - return pht('GitHub %s %s', $repo, $name); + return $this->newRawEvent($item)->getEventFullTitle(); } public function canUpdateItems() {