@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Pick better GitHub URIs for comment events

Summary: Ref T10538. Boundless joy.

Test Plan: Unit tests.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10538

Differential Revision: https://secure.phabricator.com/D15510

+17 -12
+15 -10
src/applications/nuance/github/NuanceGitHubRawEvent.php
··· 93 93 public function getURI() { 94 94 $raw = $this->raw; 95 95 96 - if ($this->isIssueEvent()) { 97 - if ($this->type == self::TYPE_ISSUE) { 98 - $uri = idxv($raw, array('issue', 'html_url')); 99 - $uri = $uri.'#event-'.$this->getID(); 100 - } else { 101 - $uri = idxv($raw, array('payload', 'issue', 'html_url')); 102 - $uri = $uri.'#event-'.$this->getID(); 103 - } 104 - } else if ($this->isPullRequestEvent()) { 96 + if ($this->isIssueEvent() || $this->isPullRequestEvent()) { 105 97 if ($this->type == self::TYPE_ISSUE) { 106 98 $uri = idxv($raw, array('issue', 'html_url')); 107 99 $uri = $uri.'#event-'.$this->getID(); ··· 109 101 // The format of pull request events varies so we need to fish around 110 102 // a bit to find the correct URI. 111 103 $uri = idxv($raw, array('payload', 'pull_request', 'html_url')); 104 + $need_anchor = true; 105 + 106 + // For comments, we get a different anchor to link to the comment. In 107 + // this case, the URI comes with an anchor already. 108 + if (!$uri) { 109 + $uri = idxv($raw, array('payload', 'comment', 'html_url')); 110 + $need_anchor = false; 111 + } 112 + 112 113 if (!$uri) { 113 114 $uri = idxv($raw, array('payload', 'issue', 'html_url')); 115 + $need_anchor = true; 114 116 } 115 - $uri = $uri.'#event-'.$this->getID(); 117 + 118 + if ($need_anchor) { 119 + $uri = $uri.'#event-'.$this->getID(); 120 + } 116 121 } 117 122 } else { 118 123 switch ($this->getIssueRawKind()) {
+1 -1
src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.pull.txt
··· 159 159 "issue.number": null, 160 160 "pull.number": 2, 161 161 "id": 3740938746, 162 - "uri": "https://github.com/epriestley/poems/pull/2#event-3740938746" 162 + "uri": "https://github.com/epriestley/poems/pull/2#issuecomment-194282800" 163 163 }
+1 -1
src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.txt
··· 96 96 "is.pull": false, 97 97 "issue.number": 1, 98 98 "id": 3733510485, 99 - "uri": "https://github.com/epriestley/poems/issues/1#event-3733510485" 99 + "uri": "https://github.com/epriestley/poems/issues/1#issuecomment-193528669" 100 100 }