From 7d3b19922ccbe58453da548ecfd3f4bdc6795b26 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 12 Jul 2013 15:05:28 -0700 Subject: [PATCH] Respect subject prefix configuration for Asana sync and include line count Summary: Ref T2852. - Respect the existing setting for `"[Differential]"`. - Show `[Request, X lines]` to make this more similar to the email. Test Plan: Sync'd to asana and got a task with the right subject: {F49950} Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T2852 Differential Revision: https://secure.phabricator.com/D6439 --- .../worker/DoorkeeperFeedWorkerAsana.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php index 6cdae91de7..5304115cd6 100644 --- a/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php +++ b/src/applications/doorkeeper/worker/DoorkeeperFeedWorkerAsana.php @@ -89,8 +89,13 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker { private function getAsanaTaskData($object) { $revision = $object; + $prefix = $this->getTitlePrefix($object); + $title = $revision->getTitle(); + $lines = pht( + '[Request, %d lines]', + new PhutilNumber($object->getLineCount())); - $name = '[Differential] D'.$revision->getID().': '.$revision->getTitle(); + $name = $prefix.' '.$lines.' D'.$revision->getID().': '.$title; $uri = PhabricatorEnv::getProductionURI('/D'.$revision->getID()); $notes = array( @@ -120,8 +125,9 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker { private function getAsanaSubtaskData($object) { $revision = $object; + $prefix = $this->getTitlePrefix($object); - $name = '[Differential] Review Request'; + $name = $prefix.' Review Request'; $uri = PhabricatorEnv::getProductionURI('/D'.$revision->getID()); $notes = array( @@ -133,7 +139,7 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker { $notes = implode("\n\n", $notes); return array( - 'name' => '[Differential] Review Request', + 'name' => $prefix.' Review Request', 'notes' => $notes, ); } @@ -611,4 +617,8 @@ final class DoorkeeperFeedWorkerAsana extends FeedPushWorker { return (5 * 60) * pow(8, $count); } + public function getTitlePrefix($object) { + return PhabricatorEnv::getEnvConfig('metamta.differential.subject-prefix'); + } + }