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

Update Asana feed publishing integration for "ExternalAccountIdentifier"

Summary: Depends on D21017. Ref T13493. Update the Asana integration so it reads the "ExternalAccountIdentifier" table instead of the old "accountID" field.

Test Plan: Linked an Asana account, used `bin/feed republish` to publish activity to Asana.

Maniphest Tasks: T13493

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

+20 -2
+20 -2
src/applications/doorkeeper/worker/DoorkeeperAsanaFeedWorker.php
··· 532 532 ->withUserPHIDs($all_phids) 533 533 ->withAccountTypes(array($provider->getProviderType())) 534 534 ->withAccountDomains(array($provider->getProviderDomain())) 535 + ->needAccountIdentifiers(true) 535 536 ->requireCapabilities( 536 537 array( 537 538 PhabricatorPolicyCapability::CAN_VIEW, ··· 540 541 ->execute(); 541 542 542 543 foreach ($accounts as $account) { 543 - $phid_map[$account->getUserPHID()] = $account->getAccountID(); 544 + $phid_map[$account->getUserPHID()] = $this->getAsanaAccountID($account); 544 545 } 545 546 546 547 // Put this back in input order. ··· 562 563 ->withUserPHIDs($user_phids) 563 564 ->withAccountTypes(array($provider->getProviderType())) 564 565 ->withAccountDomains(array($provider->getProviderDomain())) 566 + ->needAccountIdentifiers(true) 565 567 ->requireCapabilities( 566 568 array( 567 569 PhabricatorPolicyCapability::CAN_VIEW, ··· 601 603 ->withPHIDs(array($account->getUserPHID())) 602 604 ->executeOne(); 603 605 if ($user) { 604 - return array($user, $account->getAccountID(), $token); 606 + return array($user, $this->getAsanaAccountID($account), $token); 605 607 } 606 608 } 607 609 ··· 705 707 $data); 706 708 } 707 709 } 710 + 711 + private function getAsanaAccountID(PhabricatorExternalAccount $account) { 712 + $identifiers = $account->getAccountIdentifiers(); 713 + 714 + if (count($identifiers) !== 1) { 715 + throw new Exception( 716 + pht( 717 + 'Expected external Asana account to have exactly one external '. 718 + 'account identifier, found %s.', 719 + phutil_count($identifiers))); 720 + } 721 + 722 + return head($identifiers)->getIdentifierRaw(); 723 + } 724 + 725 + 708 726 709 727 }