From c99ebe84024e59033a97097e2a6ab7168b541925 Mon Sep 17 00:00:00 2001 From: epriestley Date: Tue, 25 Jun 2013 16:34:59 -0700 Subject: [PATCH] Synchronize Asana task and subtask states accurately Summary: Ref T2852. The parent task is open unless the revision is in the states "closed" or "abandoned". If it's in "needs review", it remains open. This last bit is slightly unlike Differential, but consistent with the Google Doc and generally seems like a better fit. There's no way to put the task in a "Waiting on Others" state in Asana like we can in Differential. The subtasks are closed unless the revision is in the state "needs review". This is generally consistent with Differential. Test Plan: Made a series of changes to a revision and synchronized it repeatedly: - requested changes - commandeered - requested review - abandoned Verified task and subtasks synchronized states correctly in Asana. {F47554} Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2852 Differential Revision: https://secure.phabricator.com/D6304 --- .../worker/DoorkeeperFeedWorkerAsana.php | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php index 3bde074c67..4dd899c972 100644 --- a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php +++ b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php @@ -69,10 +69,21 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker { $reviewer_phids = $revision->getReviewers(); $cc_phids = $revision->getCCPHIDs(); + switch ($revision->getStatus()) { + case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW: + $active_phids = $reviewer_phids; + $passive_phids = array(); + break; + default: + $active_phids = array(); + $passive_phids = $reviewer_phids; + break; + } + return array( $author_phid, - $reviewer_phids, - array(), + $active_phids, + $passive_phids, $cc_phids); } @@ -90,9 +101,20 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker { $notes = implode("\n\n", $notes); + switch ($revision->getStatus()) { + case ArcanistDifferentialRevisionStatus::CLOSED: + case ArcanistDifferentialRevisionStatus::ABANDONED: + $is_completed = true; + break; + default: + $is_completed = false; + break; + } + return array( 'name' => $name, 'notes' => $notes, + 'completed' => $is_completed, ); }