@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.

Allow Nuance items to provide curtain panels, link to imported tasks, parse comments

Summary:
Ref T10537.

- Let nuance items render custom curtain panels.
- Add a custom panel linking to the imported task, if one exists.
- Actually extract comments properly.

Test Plan:
Unit tests, plus:

{F1193800}

{F1193801}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10537

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

+47 -3
+4
src/applications/nuance/controller/NuanceItemViewController.php
··· 76 76 $curtain->addAction($action); 77 77 } 78 78 79 + foreach ($impl->getItemCurtainPanels($item) as $panel) { 80 + $curtain->addPanel($panel); 81 + } 82 + 79 83 return $curtain; 80 84 } 81 85
+7 -1
src/applications/nuance/github/NuanceGitHubRawEvent.php
··· 91 91 } 92 92 93 93 public function getComment() { 94 - return 'TODO: Actually extract comment text.'; 94 + if (!$this->isIssueEvent() && !$this->isPullRequestEvent()) { 95 + return null; 96 + } 97 + 98 + $raw = $this->raw; 99 + 100 + return idxv($raw, array('payload', 'comment', 'body')); 95 101 } 96 102 97 103 public function getURI() {
+1
src/applications/nuance/github/__tests__/NuanceGitHubRawEventTestCase.php
··· 51 51 'id' => $event->getID(), 52 52 'uri' => $event->getURI(), 53 53 'title.full' => $event->getEventFullTitle(), 54 + 'comment' => $event->getComment(), 54 55 ); 55 56 56 57 // Only verify the keys which are actually present in the test. This
+2 -1
src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.pull.txt
··· 160 160 "pull.number": 2, 161 161 "id": 3740938746, 162 162 "uri": "https://github.com/epriestley/poems/pull/2#issuecomment-194282800", 163 - "title.full": "GitHub epriestley/poems Pull Request #2 (Comment)" 163 + "title.full": "GitHub epriestley/poems Pull Request #2 (Comment)", 164 + "comment": "wub wub" 164 165 }
+2 -1
src/applications/nuance/github/__tests__/repositoryevents/IssueCommentEvent.created.txt
··· 97 97 "issue.number": 1, 98 98 "id": 3733510485, 99 99 "uri": "https://github.com/epriestley/poems/issues/1#issuecomment-193528669", 100 - "title.full": "GitHub epriestley/poems Issue #1 (Comment)" 100 + "title.full": "GitHub epriestley/poems Issue #1 (Comment)", 101 + "comment": "comment on issue" 101 102 }
+23
src/applications/nuance/item/NuanceGitHubEventItemType.php
··· 154 154 return $actions; 155 155 } 156 156 157 + public function getItemCurtainPanels(NuanceItem $item) { 158 + $viewer = $this->getViewer(); 159 + 160 + $panels = array(); 161 + 162 + $xobj = $this->getExternalObject($item); 163 + if ($xobj) { 164 + $xobj_phid = $xobj->getPHID(); 165 + 166 + $task = id(new ManiphestTaskQuery()) 167 + ->setViewer($viewer) 168 + ->withBridgedObjectPHIDs(array($xobj_phid)) 169 + ->executeOne(); 170 + if ($task) { 171 + $panels[] = $this->newCurtainPanel($item) 172 + ->setHeaderText(pht('Imported As')) 173 + ->appendChild($viewer->renderHandle($task->getPHID())); 174 + } 175 + } 176 + 177 + return $panels; 178 + } 179 + 157 180 protected function handleAction(NuanceItem $item, $action) { 158 181 $viewer = $this->getViewer(); 159 182 $controller = $this->getController();
+8
src/applications/nuance/item/NuanceItemType.php
··· 44 44 return array(); 45 45 } 46 46 47 + public function getItemCurtainPanels(NuanceItem $item) { 48 + return array(); 49 + } 50 + 47 51 abstract public function getItemTypeDisplayName(); 48 52 abstract public function getItemDisplayName(NuanceItem $item); 49 53 ··· 80 84 81 85 return id(new PhabricatorActionView()) 82 86 ->setHref($action_uri); 87 + } 88 + 89 + final protected function newCurtainPanel(NuanceItem $item) { 90 + return id(new PHUICurtainPanelView()); 83 91 } 84 92 85 93 final public function buildActionResponse(NuanceItem $item, $action) {