Page MenuHomePhabricator

expose renderHandle in PhabricatorModularTransactionType
ClosedPublic

Authored by avivey on Jul 5 2016, 8:02 PM.

Details

Test Plan

Tested with a transactionType from an extension.

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

avivey updated this revision to Diff 39054.Jul 5 2016, 8:02 PM
avivey retitled this revision from to expose renderHandle in PhabricatorModularTransactionType.
avivey updated this object.
avivey edited the test plan for this revision. (Show Details)
avivey added a reviewer: epriestley.
epriestley requested changes to this revision.Jul 5 2016, 9:00 PM
epriestley edited edge metadata.

Oh, sorry -- I want to get rid of getRequiredHandlePHIDs() with ModularTransactions, since HandlePool should be able to do it for us now. Can we try something like this instead?

final protected function renderHandle($phid) {
  $viewer = $this->getViewer();
  $display = $viewer->renderHandle($phid);

  if ($storage->getRenderingTarget() == PhabricatorApplicationTransaction::TARGET_TEXT) {
    $display->setAsText(true);
  }

  return $display;
}

Then implement setAsText() on PHUIHandleView, and have it just return $handle->getLinkName() from render() if set?

Then we shouldn't need to do all the getRequiredHandlePHIDs() stuff, but should still get efficient bulk-loading of handles via HandlePool, I think. I may also need to adjust how pht() works a little bit.

This revision now requires changes to proceed.Jul 5 2016, 9:00 PM
avivey added a comment.Jul 5 2016, 9:30 PM

One small hitch is that we don't actually have a $viewer yet in getTitle()... I think we can explicitly $xaction->setViewer() in all the right places except Doorkeeper (Which bypasses policy?) but I need to dig a bit further to be sure.
Otherwise, pht() seems to be ok with rendering the handle.

avivey added a comment.Jul 6 2016, 1:18 AM

OK, so PhabricatorApplicationTransactionQuery already calls attachViewer, so this is probably ok...

avivey updated this revision to Diff 39059.Jul 6 2016, 1:18 AM
avivey edited edge metadata.

use HandlePool

epriestley accepted this revision.Jul 6 2016, 1:19 AM
epriestley edited edge metadata.
epriestley added inline comments.
src/applications/transactions/storage/PhabricatorModularTransactionType.php
132–134

Just nuke now?

This revision is now accepted and ready to land.Jul 6 2016, 1:19 AM
avivey added inline comments.Jul 6 2016, 1:19 AM
src/applications/transactions/storage/PhabricatorModularTransaction.php
132

This one is a little weird - it's getting $viewer again...

avivey updated this revision to Diff 39060.Jul 6 2016, 1:20 AM
avivey edited edge metadata.

Remove empty method

This revision was automatically updated to reflect the committed changes.
zonestc added a child revision: Restricted Differential Revision.Jul 6 2016, 9:16 PM