mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-19 05:12:41 +01:00
Always link to "#5" (not "#comment-5") for "T123#5"
Summary: Fixes T3976. Long ago, some applications used "#comment-5" instead of "#5" for transaction/comment anchors. Now everything (I think?) uses "#5"; this is the style used by ApplicationTransactions. This might break some very old, explcit `T123#comment-5` links, or off-site links to the `comment-N` anchors, but all that stuff generally got renumbered when we migrated anyway and getting you to the right object is like 95% of the job. Test Plan: Verified that `T123#5` now links to `#5`. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T3976 Differential Revision: https://secure.phabricator.com/D8542
This commit is contained in:
parent
7be740cd30
commit
3bea0958dd
1 changed files with 3 additions and 10 deletions
|
@ -42,17 +42,10 @@ abstract class PhabricatorRemarkupRuleObject
|
|||
protected function renderObjectRef($object, $handle, $anchor, $id) {
|
||||
$href = $handle->getURI();
|
||||
$text = $this->getObjectNamePrefix().$id;
|
||||
|
||||
if ($anchor) {
|
||||
$matches = null;
|
||||
if (preg_match('@^(?:comment-)?(\d{1,7})$@', $anchor, $matches)) {
|
||||
// Maximum length is 7 because 12345678 could be a file hash in
|
||||
// Differential.
|
||||
$href = $href.'#comment-'.$matches[1];
|
||||
$text = $text.'#'.$matches[1];
|
||||
} else {
|
||||
$href = $href.'#'.$anchor;
|
||||
$text = $text.'#'.$anchor;
|
||||
}
|
||||
$href = $href.'#'.$anchor;
|
||||
$text = $text.'#'.$anchor;
|
||||
}
|
||||
|
||||
if ($this->getEngine()->isTextMode()) {
|
||||
|
|
Loading…
Reference in a new issue