1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-03 04:02:43 +01:00
phorge-phorge/src/applications/ponder/controller/PonderVoteSaveController.php
epriestley 5037ba1cf8 Restore voting to Ponder
Summary: Ref T3578. Restores the voting UI and makes it a little prettier.

Test Plan: {F52089}

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T3578

Differential Revision: https://secure.phabricator.com/D6614
2013-07-29 12:04:13 -07:00

33 lines
773 B
PHP

<?php
final class PonderVoteSaveController extends PonderController {
public function processRequest() {
$request = $this->getRequest();
$viewer = $request->getUser();
$phid = $request->getStr('phid');
$newvote = $request->getInt('vote');
if (1 < $newvote || $newvote < -1) {
return new Aphront400Response();
}
$target = null;
$object = id(new PhabricatorObjectQuery())
->setViewer($viewer)
->withPHIDs(array($phid))
->executeOne();
if (!$object) {
return new Aphront404Response();
}
$editor = id(new PonderVoteEditor())
->setVotable($object)
->setActor($viewer)
->setVote($newvote)
->saveVote();
return id(new AphrontAjaxResponse())->setContent(array());
}
}