From 3bea0958dd318dd47525edc69f4e76543aefcd66 Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 14 Mar 2014 14:50:40 -0700 Subject: [PATCH] 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 --- .../markup/rule/PhabricatorRemarkupRuleObject.php | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObject.php b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObject.php index 252195c7b4..0d9c940685 100644 --- a/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObject.php +++ b/src/infrastructure/markup/rule/PhabricatorRemarkupRuleObject.php @@ -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()) {