1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-20 13:52:40 +01:00

Fix two problems with actor order in Asana bridge

Summary: We attempt to choose the most reasonable actor when synchronizing to Asana, but Asana is seeing the sync choose a less-reasonable actor. I spotted two places where the order may get disrupted; make sure we retain order. This is somewhat tricky to repro locally (it depends on things like native account order) but I think this is the right fix. If not, I'll add more logging. Ref T2852.

Test Plan: Used `bin/feed republish` to sync Asana events.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2852

Differential Revision: https://secure.phabricator.com/D6443
This commit is contained in:
epriestley 2013-07-13 10:41:23 -07:00
parent 0acdab7fc6
commit 0fe18f5460

View file

@ -163,6 +163,8 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker {
$object = $this->getStoryObject();
$src_phid = $object->getPHID();
$chronological_key = $story->getChronologicalKey();
if (!$this->isObjectSupported($object)) {
$this->log("Story is about an unsupported object type.\n");
return;
@ -189,8 +191,10 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker {
$follow_phids);
$all_follow_phids = array_unique(array_filter($all_follow_phids));
$all_phids = $all_follow_phids;
$all_phids[] = $owner_phid;
$all_phids = array();
$all_phids = array_merge(
array($owner_phid),
$all_follow_phids);
$all_phids = array_unique(array_filter($all_phids));
$phid_aid_map = $this->lookupAsanaUserIDs($all_phids);
@ -537,6 +541,12 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker {
->withAccountDomains(array($provider->getProviderDomain()))
->execute();
// Reorder accounts in the original order.
// TODO: This needs to be adjusted if/when we allow you to link multiple
// accounts.
$accounts = mpull($accounts, null, 'getUserPHID');
$accounts = array_select_keys($accounts, $user_phids);
$workspace_id = $this->getWorkspaceID();
foreach ($accounts as $account) {