Page MenuHomePhabricator

D15510.id.diff
No OneTemporary

D15510.id.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
@@ -93,15 +93,7 @@
public function getURI() {
$raw = $this->raw;
- if ($this->isIssueEvent()) {
- if ($this->type == self::TYPE_ISSUE) {
- $uri = idxv($raw, array('issue', 'html_url'));
- $uri = $uri.'#event-'.$this->getID();
- } else {
- $uri = idxv($raw, array('payload', 'issue', 'html_url'));
- $uri = $uri.'#event-'.$this->getID();
- }
- } else if ($this->isPullRequestEvent()) {
+ if ($this->isIssueEvent() || $this->isPullRequestEvent()) {
if ($this->type == self::TYPE_ISSUE) {
$uri = idxv($raw, array('issue', 'html_url'));
$uri = $uri.'#event-'.$this->getID();
@@ -109,10 +101,23 @@
// The format of pull request events varies so we need to fish around
// a bit to find the correct URI.
$uri = idxv($raw, array('payload', 'pull_request', 'html_url'));
+ $need_anchor = true;
+
+ // For comments, we get a different anchor to link to the comment. In
+ // this case, the URI comes with an anchor already.
+ if (!$uri) {
+ $uri = idxv($raw, array('payload', 'comment', 'html_url'));
+ $need_anchor = false;
+ }
+
if (!$uri) {
$uri = idxv($raw, array('payload', 'issue', 'html_url'));
+ $need_anchor = true;
+ }
+
+ if ($need_anchor) {
+ $uri = $uri.'#event-'.$this->getID();
}
- $uri = $uri.'#event-'.$this->getID();
}
} else {
switch ($this->getIssueRawKind()) {
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
@@ -159,5 +159,5 @@
"issue.number": null,
"pull.number": 2,
"id": 3740938746,
- "uri": "https://github.com/epriestley/poems/pull/2#event-3740938746"
+ "uri": "https://github.com/epriestley/poems/pull/2#issuecomment-194282800"
}
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
@@ -96,5 +96,5 @@
"is.pull": false,
"issue.number": 1,
"id": 3733510485,
- "uri": "https://github.com/epriestley/poems/issues/1#event-3733510485"
+ "uri": "https://github.com/epriestley/poems/issues/1#issuecomment-193528669"
}

File Metadata

Mime Type
text/plain
Expires
May 16 2024, 6:03 AM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6279386
Default Alt Text
D15510.id.diff (2 KB)

Event Timeline