1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 08:52:39 +01:00

Synchronize follower data with parent tasks in Asana bridge

Summary: Ref T2852. Setting followers (like CCs) is a separate API call, but we don't need to do anything complicated.

Test Plan: Synchronized revisions and verified the parent task got followers.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2852

Differential Revision: https://secure.phabricator.com/D6308
This commit is contained in:
epriestley 2013-06-25 16:35:55 -07:00
parent 816b90a0a1
commit 5db26c1b3a

View file

@ -259,7 +259,7 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker {
if ($edge_cursor <= $story->getChronologicalKey()) {
$this->log("Updating main task.\n");
// TODO: We need to synchronize 'followers' separately.
// We need to synchronize follower data separately.
$put_data = $main_data;
unset($put_data['followers']);
@ -268,6 +268,22 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker {
"tasks/".$parent_ref->getObjectID(),
'PUT',
$put_data);
// To synchronize follower data, just add all the followers. The task
// might have additional followers, but we can't really tell how they
// got there: were they CC'd and then unsubscribed, or did they
// manually follow the task? Assume the latter since it's easier and
// less destructive and the former is rare.
if ($main_data['followers']) {
$this->makeAsanaAPICall(
$oauth_token,
'tasks/'.$parent_ref->getObjectID().'/addFollowers',
'POST',
array(
'followers' => $main_data['followers'],
));
}
} else {
$this->log(
"Skipping main task update, cursor is ahead of the story.\n");