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

Add a Nuance content source, and make use of it

Summary: Ref T10537. Add a new content source for Nuance. Prepare for better author attribution.

Test Plan: {F1194038}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10537

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

+43 -9
+2
src/__phutil_library_map__.php
··· 1426 1426 'MultimeterViewer' => 'applications/multimeter/storage/MultimeterViewer.php', 1427 1427 'NuanceConduitAPIMethod' => 'applications/nuance/conduit/NuanceConduitAPIMethod.php', 1428 1428 'NuanceConsoleController' => 'applications/nuance/controller/NuanceConsoleController.php', 1429 + 'NuanceContentSource' => 'applications/nuance/contentsource/NuanceContentSource.php', 1429 1430 'NuanceController' => 'applications/nuance/controller/NuanceController.php', 1430 1431 'NuanceDAO' => 'applications/nuance/storage/NuanceDAO.php', 1431 1432 'NuanceGitHubEventItemType' => 'applications/nuance/item/NuanceGitHubEventItemType.php', ··· 5726 5727 'MultimeterViewer' => 'MultimeterDimension', 5727 5728 'NuanceConduitAPIMethod' => 'ConduitAPIMethod', 5728 5729 'NuanceConsoleController' => 'NuanceController', 5730 + 'NuanceContentSource' => 'PhabricatorContentSource', 5729 5731 'NuanceController' => 'PhabricatorController', 5730 5732 'NuanceDAO' => 'PhabricatorLiskDAO', 5731 5733 'NuanceGitHubEventItemType' => 'NuanceItemType',
+16
src/applications/nuance/contentsource/NuanceContentSource.php
··· 1 + <?php 2 + 3 + final class NuanceContentSource 4 + extends PhabricatorContentSource { 5 + 6 + const SOURCECONST = 'nuance'; 7 + 8 + public function getSourceName() { 9 + return pht('Nuance'); 10 + } 11 + 12 + public function getSourceDescription() { 13 + return pht('Content imported via Nuance.'); 14 + } 15 + 16 + }
+10 -9
src/applications/nuance/item/NuanceGitHubEventItemType.php
··· 297 297 $xobj_phid)); 298 298 } 299 299 300 - $nuance_phid = id(new PhabricatorNuanceApplication())->getPHID(); 300 + $acting_as_phid = $this->getActingAsPHID($item); 301 301 302 302 $xactions = array(); 303 303 ··· 307 307 ->executeOne(); 308 308 if (!$task) { 309 309 $task = ManiphestTask::initializeNewTask($viewer) 310 - ->setAuthorPHID($nuance_phid) 310 + ->setAuthorPHID($acting_as_phid) 311 311 ->setBridgedObjectPHID($xobj_phid); 312 312 313 313 $title = $xobj->getProperty('task.title'); ··· 344 344 ->setContent($comment)); 345 345 } 346 346 347 - // TODO: Preserve the item's original source. 348 - $source = PhabricatorContentSource::newForSource( 349 - PhabricatorDaemonContentSource::SOURCECONST); 350 - 351 - // TODO: This should really be the external source. 352 - $acting_phid = $nuance_phid; 347 + $agent_phid = $command->getAuthorPHID(); 348 + $source = $this->newContentSource($item, $agent_phid); 353 349 354 350 $editor = id(new ManiphestTransactionEditor()) 355 351 ->setActor($viewer) 356 - ->setActingAsPHID($acting_phid) 352 + ->setActingAsPHID($acting_as_phid) 357 353 ->setContentSource($source) 358 354 ->setContinueOnNoEffect(true) 359 355 ->setContinueOnMissingFields(true); ··· 366 362 ); 367 363 } 368 364 365 + protected function getActingAsPHID(NuanceItem $item) { 366 + // TODO: This should be an external account PHID representing the original 367 + // GitHub user. 368 + return parent::getActingAsPHID($item); 369 + } 369 370 370 371 }
+15
src/applications/nuance/item/NuanceItemType.php
··· 144 144 return null; 145 145 } 146 146 147 + final protected function newContentSource( 148 + NuanceItem $item, 149 + $agent_phid) { 150 + return PhabricatorContentSource::newForSource( 151 + NuanceContentSource::SOURCECONST, 152 + array( 153 + 'itemPHID' => $item->getPHID(), 154 + 'agentPHID' => $agent_phid, 155 + )); 156 + } 157 + 158 + protected function getActingAsPHID(NuanceItem $item) { 159 + return id(new PhabricatorNuanceApplication())->getPHID(); 160 + } 161 + 147 162 }