Page MenuHomePhabricator

D15517.diff
No OneTemporary

D15517.diff

diff --git a/src/applications/nuance/github/NuanceGitHubRawEvent.php b/src/applications/nuance/github/NuanceGitHubRawEvent.php
--- a/src/applications/nuance/github/NuanceGitHubRawEvent.php
+++ b/src/applications/nuance/github/NuanceGitHubRawEvent.php
@@ -91,7 +91,19 @@
}
public function getComment() {
- return 'TODO: Actually extract comment text.';
+ if ($this->type == self::TYPE_REPOSITORY) {
+ if ($this->isIssueEvent() || $this->isPullRequestEvent()) {
+ $raw = $this->raw;
+
+ $type = idx($raw, 'type');
+ switch ($type) {
+ case 'IssueCommentEvent':
+ return idxv($raw, array('payload', 'comment', 'body'));
+ }
+ }
+ }
+
+ return null;
}
public function getURI() {
diff --git a/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php b/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php
--- a/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php
+++ b/src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php
@@ -51,6 +51,7 @@
'id' => $event->getID(),
'uri' => $event->getURI(),
'title.full' => $event->getEventFullTitle(),
+ 'comment' => $event->getComment(),
);
// Only verify the keys which are actually present in the test. This
diff --git a/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.pull.txt b/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.pull.txt
--- a/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.pull.txt
+++ b/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.pull.txt
@@ -160,5 +160,6 @@
"pull.number": 2,
"id": 3740938746,
"uri": "https://github.com/epriestley/poems/pull/2#issuecomment-194282800",
- "title.full": "GitHub epriestley/poems Pull Request #2 (Comment)"
+ "title.full": "GitHub epriestley/poems Pull Request #2 (Comment)",
+ "comment": "wub wub"
}
diff --git a/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.txt b/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.txt
--- a/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.txt
+++ b/src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.txt
@@ -97,5 +97,6 @@
"issue.number": 1,
"id": 3733510485,
"uri": "https://github.com/epriestley/poems/issues/1#issuecomment-193528669",
- "title.full": "GitHub epriestley/poems Issue #1 (Comment)"
+ "title.full": "GitHub epriestley/poems Issue #1 (Comment)",
+ "comment": "comment on issue"
}

File Metadata

Mime Type
text/plain
Expires
Thu, Oct 17, 3:35 PM (2 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6720394
Default Alt Text
D15517.diff (2 KB)

Event Timeline