Fix Phriction document linking in mail bodies
Summary:
Fixes T10840. When rendering mail, this rule wasn't falling through in quite the right way.
Also adjust where the rules are for this so the special styles show up in Maniphest, etc.
Test Plan:
Made this comment:
{F1238266}
Which produced this HTML:
{F1238267}
...and sent this mail:
{F1238283}
Reviewers: hach-que, chad
Reviewed By: chad
Maniphest Tasks: T10840
Differential Revision: https://secure.phabricator.com/D15767
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*/
|
||||
return array(
|
||||
'names' => array(
|
||||
'core.pkg.css' => 'ce06b6f6',
|
||||
'core.pkg.css' => '31417876',
|
||||
'core.pkg.js' => '37344f3c',
|
||||
'darkconsole.pkg.js' => 'e7393ebb',
|
||||
'differential.pkg.css' => '7ba78475',
|
||||
@@ -88,7 +88,7 @@ return array(
|
||||
'rsrc/css/application/phortune/phortune-credit-card-form.css' => '8391eb02',
|
||||
'rsrc/css/application/phortune/phortune.css' => '9149f103',
|
||||
'rsrc/css/application/phrequent/phrequent.css' => 'ffc185ad',
|
||||
'rsrc/css/application/phriction/phriction-document-css.css' => '55446c91',
|
||||
'rsrc/css/application/phriction/phriction-document-css.css' => '4282e4ad',
|
||||
'rsrc/css/application/policy/policy-edit.css' => '815c66f7',
|
||||
'rsrc/css/application/policy/policy-transaction-detail.css' => '82100a43',
|
||||
'rsrc/css/application/policy/policy.css' => '957ea14c',
|
||||
@@ -104,7 +104,7 @@ return array(
|
||||
'rsrc/css/application/tokens/tokens.css' => '3d0f239e',
|
||||
'rsrc/css/application/uiexample/example.css' => '528b19de',
|
||||
'rsrc/css/core/core.css' => 'd0801452',
|
||||
'rsrc/css/core/remarkup.css' => '2c9ed46f',
|
||||
'rsrc/css/core/remarkup.css' => '6aae5360',
|
||||
'rsrc/css/core/syntax.css' => '9fd11da8',
|
||||
'rsrc/css/core/z-index.css' => '5b6fcf3f',
|
||||
'rsrc/css/diviner/diviner-shared.css' => 'aa3656aa',
|
||||
@@ -777,7 +777,7 @@ return array(
|
||||
'phabricator-object-selector-css' => '85ee8ce6',
|
||||
'phabricator-phtize' => 'd254d646',
|
||||
'phabricator-prefab' => 'e67df814',
|
||||
'phabricator-remarkup-css' => '2c9ed46f',
|
||||
'phabricator-remarkup-css' => '6aae5360',
|
||||
'phabricator-search-results-css' => '7dea472c',
|
||||
'phabricator-shaped-request' => '7cbe244b',
|
||||
'phabricator-side-menu-view-css' => '3a3d9f41',
|
||||
@@ -807,7 +807,7 @@ return array(
|
||||
'phortune-credit-card-form-css' => '8391eb02',
|
||||
'phortune-css' => '9149f103',
|
||||
'phrequent-css' => 'ffc185ad',
|
||||
'phriction-document-css' => '55446c91',
|
||||
'phriction-document-css' => '4282e4ad',
|
||||
'phui-action-panel-css' => '91c7b835',
|
||||
'phui-badge-view-css' => '3baef8db',
|
||||
'phui-big-info-view-css' => 'bd903741',
|
||||
|
||||
@@ -107,6 +107,10 @@ final class PhrictionRemarkupRule extends PhutilRemarkupRule {
|
||||
$name = $spec['explicitName'];
|
||||
$class = 'phriction-link';
|
||||
|
||||
// If the name is something meaningful to humans, we'll render this
|
||||
// in text as: "Title" <link>. Otherwise, we'll just render: <link>.
|
||||
$is_interesting_name = (bool)strlen($name);
|
||||
|
||||
if (idx($existant_documents, $link) === null) {
|
||||
// The target document doesn't exist.
|
||||
if ($name === null) {
|
||||
@@ -127,6 +131,8 @@ final class PhrictionRemarkupRule extends PhutilRemarkupRule {
|
||||
$name = $visible_documents[$link]
|
||||
->getContent()
|
||||
->getTitle();
|
||||
|
||||
$is_interesting_name = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,7 +149,12 @@ final class PhrictionRemarkupRule extends PhutilRemarkupRule {
|
||||
if ($this->getEngine()->getState('toc')) {
|
||||
$text = $name;
|
||||
} else if ($text_mode || $mail_mode) {
|
||||
return PhabricatorEnv::getProductionURI($href);
|
||||
$href = PhabricatorEnv::getProductionURI($href);
|
||||
if ($is_interesting_name) {
|
||||
$text = pht('"%s" <%s>', $name, $href);
|
||||
} else {
|
||||
$text = pht('<%s>', $href);
|
||||
}
|
||||
} else {
|
||||
if ($class === 'phriction-link-lock') {
|
||||
$name = array(
|
||||
@@ -164,8 +175,9 @@ final class PhrictionRemarkupRule extends PhutilRemarkupRule {
|
||||
'class' => $class,
|
||||
),
|
||||
$name);
|
||||
$this->getEngine()->overwriteStoredText($spec['token'], $text);
|
||||
}
|
||||
|
||||
$this->getEngine()->overwriteStoredText($spec['token'], $text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,17 +32,3 @@
|
||||
.phriction-history-nav-table td.nav-next {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.phui-document-content .phriction-link {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.phui-document-content .phriction-link-missing {
|
||||
font-weight: bold;
|
||||
color: {$red};
|
||||
}
|
||||
|
||||
.phui-document-content .phriction-link-lock {
|
||||
font-weight: bold;
|
||||
color: {$greytext};
|
||||
}
|
||||
|
||||
@@ -234,6 +234,18 @@
|
||||
background: #ffaaaa;
|
||||
}
|
||||
|
||||
.phabricator-remarkup .phriction-link {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.phabricator-remarkup .phriction-link-missing {
|
||||
color: {$red};
|
||||
}
|
||||
|
||||
.phabricator-remarkup .phriction-link-lock {
|
||||
color: {$greytext};
|
||||
}
|
||||
|
||||
.phabricator-remarkup-mention-nopermission .phui-tag-core {
|
||||
background: {$lightgreybackground};
|
||||
color: {$lightgreytext};
|
||||
|
||||
Reference in New Issue
Block a user