From 222b25f3a2b6b6584f2e9e8d862b9e644ae96750 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 22 Feb 2013 05:44:46 -0800 Subject: [PATCH] Allow CCs to be specified and edited for mocks Summary: Not sure if we're going to do reviewers or whatever, but let mock creators share mocks with lists or individuals. Test Plan: Created a mock with "duck" and "dog" cc'd, verified they showed up on the email. Reviewers: chad Reviewed By: chad CC: aran Maniphest Tasks: T2568 Differential Revision: https://secure.phabricator.com/D5056 --- .../controller/PholioMockEditController.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/applications/pholio/controller/PholioMockEditController.php b/src/applications/pholio/controller/PholioMockEditController.php index ae577497c2..00e35c4364 100644 --- a/src/applications/pholio/controller/PholioMockEditController.php +++ b/src/applications/pholio/controller/PholioMockEditController.php @@ -51,6 +51,8 @@ final class PholioMockEditController extends PholioController { $v_name = $mock->getName(); $v_desc = $mock->getDescription(); $v_view = $mock->getViewPolicy(); + $v_cc = PhabricatorSubscribersQuery::loadSubscribersForPHID( + $mock->getPHID()); if ($request->isFormPost()) { $xactions = array(); @@ -58,14 +60,17 @@ final class PholioMockEditController extends PholioController { $type_name = PholioTransactionType::TYPE_NAME; $type_desc = PholioTransactionType::TYPE_DESCRIPTION; $type_view = PhabricatorTransactions::TYPE_VIEW_POLICY; + $type_cc = PhabricatorTransactions::TYPE_SUBSCRIBERS; $v_name = $request->getStr('name'); $v_desc = $request->getStr('description'); $v_view = $request->getStr('can_view'); + $v_cc = $request->getArr('cc'); $xactions[$type_name] = $v_name; $xactions[$type_desc] = $v_desc; $xactions[$type_view] = $v_view; + $xactions[$type_cc] = array('=' => $v_cc); if (!strlen($request->getStr('name'))) { $e_name = 'Required'; @@ -165,6 +170,12 @@ final class PholioMockEditController extends PholioController { // NOTE: Make this show up correctly on the rendered form. $mock->setViewPolicy($v_view); + $handles = id(new PhabricatorObjectHandleData($v_cc)) + ->setViewer($user) + ->loadHandles(); + + $cc_tokens = mpull($handles, 'getFullName', 'getPHID'); + $form = id(new AphrontFormView()) ->setUser($user) ->setFlexible(true) @@ -185,6 +196,13 @@ final class PholioMockEditController extends PholioController { ->setName('file_phids') ->setLabel(pht('Images')) ->setError($e_images)) + ->appendChild( + id(new AphrontFormTokenizerControl()) + ->setLabel(pht('CC')) + ->setName('cc') + ->setValue($cc_tokens) + ->setUser($user) + ->setDatasource('/typeahead/common/mailable/')) ->appendChild( id(new AphrontFormPolicyControl()) ->setUser($user)