1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-03-28 12:08:14 +01:00
phorge-phorge/src/applications/pholio/controller/PholioInlineViewController.php
epriestley 0a069cb55a Require a viewer to load handles
Summary:
Unmuck almost all of the we-sort-of-have-viewers-some-of-the-time mess.

There are a few notable cases here:

  - I used Omnipotent users when indexing objects for search. I think this is correct; we do policy filtering when showing results.
  - I cheated in a bad way in the Remarkup object rule, but fixing this requires fixing all the PhabricatorRemarkupEngine callsites (there are 85). I'll do that in the next diff.
  - I cheated in a few random places, like when sending mail about package edits. These aren't a big deal.

Test Plan:
  - Grepped for all PhabricatorObjectHandleData references.
  - Gave them viewers.

Reviewers: vrana

Reviewed By: vrana

CC: aran, edward

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D5151
2013-02-28 17:15:09 -08:00

38 lines
990 B
PHP

<?php
/**
* @group pholio
*/
final class PholioInlineViewController extends PholioController {
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$inline_comment = id(new PholioTransactionComment())->load($this->id);
$handle = PhabricatorObjectHandleData::loadOneHandle(
$inline_comment->getAuthorPHID(),
$user);
$inline_view = id(new PholioInlineCommentView())
->setHandle($handle)
->setInlineComment($inline_comment);
if ($inline_comment->getEditPolicy(PhabricatorPolicyCapability::CAN_EDIT)
== $user->getPHID() && $inline_comment->getTransactionPHID() === null) {
$inline_view->setEditable(true);
}
return id(new AphrontAjaxResponse())->setContent(
$inline_comment->toDictionary() + array(
'contentHTML' => $inline_view->render(),
));
}
}