1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-03 20:22:46 +01:00
phorge-phorge/src/applications/ponder/controller/PonderVoteSaveController.php

34 lines
773 B
PHP
Raw Normal View History

<?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());
}
}