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:
parent
aa8c661d5d
commit
ab7a091212
3 changed files with 17 additions and 11 deletions
|
@ -61,12 +61,16 @@ final class DoorkeeperRemarkupRuleAsana
|
||||||
'id' => $tag_id,
|
'id' => $tag_id,
|
||||||
) + $spec['tag'];
|
) + $spec['tag'];
|
||||||
|
|
||||||
$view = id(new PhabricatorTagView())
|
if ($this->getEngine()->isTextMode()) {
|
||||||
->setID($tag_id)
|
$view = $spec['href'];
|
||||||
->setName($spec['href'])
|
} else {
|
||||||
->setHref($spec['href'])
|
$view = id(new PhabricatorTagView())
|
||||||
->setType(PhabricatorTagView::TYPE_OBJECT)
|
->setID($tag_id)
|
||||||
->setExternal(true);
|
->setName($spec['href'])
|
||||||
|
->setHref($spec['href'])
|
||||||
|
->setType(PhabricatorTagView::TYPE_OBJECT)
|
||||||
|
->setExternal(true);
|
||||||
|
}
|
||||||
|
|
||||||
$engine->overwriteStoredText($spec['token'], $view);
|
$engine->overwriteStoredText($spec['token'], $view);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue