1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +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, 'id' => $tag_id,
) + $spec['tag']; ) + $spec['tag'];
if ($this->getEngine()->isTextMode()) {
$view = $spec['href'];
} else {
$view = id(new PhabricatorTagView()) $view = id(new PhabricatorTagView())
->setID($tag_id) ->setID($tag_id)
->setName($spec['href']) ->setName($spec['href'])
->setHref($spec['href']) ->setHref($spec['href'])
->setType(PhabricatorTagView::TYPE_OBJECT) ->setType(PhabricatorTagView::TYPE_OBJECT)
->setExternal(true); ->setExternal(true);
}
$engine->overwriteStoredText($spec['token'], $view); $engine->overwriteStoredText($spec['token'], $view);
} }

View file

@ -231,7 +231,9 @@ final class PhabricatorObjectHandle
} }
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { 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) { protected function loadHandles(array $objects) {
$phids = mpull($objects, 'getPHID'); $phids = mpull($objects, 'getPHID');
$query = new PhabricatorObjectHandleData($phids);
$viewer = $this->getEngine()->getConfig('viewer'); $handles = id(new PhabricatorHandleQuery($phids))
$query->setViewer($viewer); ->withPHIDs($phids)
$handles = $query->loadHandles(); ->setViewer($this->getEngine()->getConfig('viewer'))
->execute();
$result = array(); $result = array();
foreach ($objects as $id => $object) { foreach ($objects as $id => $object) {