1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-22 10:18:48 +02:00
phorge-phorge/src/applications/maniphest/controller/ManiphestSubscribeController.php
Gareth Evans 67da5d6e4b Add Subscribe option to maniphest
Summary:
Same as //Subscribe//, //Unsubscribe// and //Automatically Subscribed// in differential.

Manually updated library map as windows is fun!

Test Plan: Subscribe, Unsubscribe!

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5809
2013-05-03 15:47:39 -07:00

40 lines
861 B
PHP

<?php
final class ManiphestSubscribeController extends ManiphestController {
private $id;
private $action;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
$this->action = $data['action'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$task = id(new ManiphestTask())->load($this->id);
if (!$task) {
return new Aphront404Response();
}
switch ($this->action) {
case 'add':
ManiphestTransactionEditor::addCC(
$task,
$user);
break;
case 'rem':
ManiphestTransactionEditor::removeCC(
$task,
$user);
break;
default:
return new Aphront400Response();
}
return id(new AphrontRedirectResponse())->setURI('/T'.$task->getID());
}
}