[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class ManiphestSubscribeController extends ManiphestController { 4 5 private $id; 6 private $action; 7 8 public function willProcessRequest(array $data) { 9 $this->id = $data['id']; 10 $this->action = $data['action']; 11 } 12 13 public function processRequest() { 14 15 $request = $this->getRequest(); 16 $user = $request->getUser(); 17 18 $task = id(new ManiphestTaskQuery()) 19 ->setViewer($user) 20 ->withIDs(array($this->id)) 21 ->executeOne(); 22 if (!$task) { 23 return new Aphront404Response(); 24 } 25 26 $ccs = $task->getCCPHIDs(); 27 switch ($this->action) { 28 case 'add': 29 $ccs[] = $user->getPHID(); 30 break; 31 case 'rem': 32 $ccs = array_diff($ccs, array($user->getPHID())); 33 break; 34 default: 35 return new Aphront400Response(); 36 } 37 38 $xaction = id(new ManiphestTransaction()) 39 ->setTransactionType(ManiphestTransaction::TYPE_CCS) 40 ->setNewValue($ccs); 41 42 $editor = id(new ManiphestTransactionEditor()) 43 ->setActor($user) 44 ->setContentSourceFromRequest($request) 45 ->setContinueOnNoEffect(true) 46 ->setContinueOnMissingFields(true) 47 ->applyTransactions($task, array($xaction)); 48 49 return id(new AphrontRedirectResponse())->setURI('/T'.$task->getID()); 50 } 51 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |