From 6b9b1d4f95c2f868a9764b7aeb81f41e65974d4c Mon Sep 17 00:00:00 2001 From: Bob Trahan Date: Mon, 1 Oct 2012 15:39:14 -0700 Subject: [PATCH] Make audit only add ccs or auditors if that was the user's intended action Summary: this plugs this at the controller level. the editor could also be more aware of the "action" and the fix could be there. Test Plan: set some ccs, changed it to comment, made teh comment, noted no ccs. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T1838 Differential Revision: https://secure.phabricator.com/D3590 --- .../PhabricatorAuditAddCommentController.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/applications/audit/controller/PhabricatorAuditAddCommentController.php b/src/applications/audit/controller/PhabricatorAuditAddCommentController.php index f380d0edff..d0180d4785 100644 --- a/src/applications/audit/controller/PhabricatorAuditAddCommentController.php +++ b/src/applications/audit/controller/PhabricatorAuditAddCommentController.php @@ -44,8 +44,21 @@ final class PhabricatorAuditAddCommentController ->setAction($action) ->setContent($request->getStr('content')); - $auditors = $request->getArr('auditors'); - $ccs = $request->getArr('ccs'); + // make sure we only add auditors or ccs if the action matches + switch ($action) { + case 'add_auditors': + $auditors = $request->getArr('auditors'); + $ccs = array(); + break; + case 'add_ccs': + $auditors = array(); + $ccs = $request->getArr('ccs'); + break; + default: + $auditors = array(); + $ccs = array(); + break; + } id(new PhabricatorAuditCommentEditor($commit)) ->setUser($user)