1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 06:42:42 +01:00

Fix text-mode rendering of object and Asana link views

Summary:
Ref T2852. Two issues:

  - Embeds (`T12`, `{T12}`) have some handle issues because handles run afoul of visibility checks under some configs. Make handles unconditionally visible.
  - Asana links don't render correctly into text mode. Give them a valid text mode rendering so they don't flip out.

Test Plan: Made comments with `T12` and `http://app.asana.com/...` and published them to Asana.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2852

Differential Revision: https://secure.phabricator.com/D6696
This commit is contained in:
epriestley 2013-08-07 13:29:09 -07:00
parent aa8c661d5d
commit ab7a091212
3 changed files with 17 additions and 11 deletions

View file

@ -61,12 +61,16 @@ final class DoorkeeperRemarkupRuleAsana
'id' => $tag_id,
) + $spec['tag'];
if ($this->getEngine()->isTextMode()) {
$view = $spec['href'];
} else {
$view = id(new PhabricatorTagView())
->setID($tag_id)
->setName($spec['href'])
->setHref($spec['href'])
->setType(PhabricatorTagView::TYPE_OBJECT)
->setExternal(true);
}
$engine->overwriteStoredText($spec['token'], $view);
}

View file

@ -231,7 +231,9 @@ final class PhabricatorObjectHandle
}
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
return false;
// NOTE: Handles are always visible, they just don't get populated with
// data if the user can't see the underlying object.
return true;
}
}

View file

@ -26,11 +26,11 @@ abstract class PhabricatorRemarkupRuleObject
protected function loadHandles(array $objects) {
$phids = mpull($objects, 'getPHID');
$query = new PhabricatorObjectHandleData($phids);
$viewer = $this->getEngine()->getConfig('viewer');
$query->setViewer($viewer);
$handles = $query->loadHandles();
$handles = id(new PhabricatorHandleQuery($phids))
->withPHIDs($phids)
->setViewer($this->getEngine()->getConfig('viewer'))
->execute();
$result = array();
foreach ($objects as $id => $object) {