@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Move object monogram rules later in the parse order

Summary:
Fixes T5837. The problem is that the hash is being recognized as a commit hash. We currently fire the object monogram rules fairly early, but there's no real reason to do this. Move them after all of the hyperlink rules:

0 PhutilRemarkupEscapeRemarkupRule
100 PhutilRemarkupMonospaceRule
150 PhutilRemarkupDocumentLinkRule
175 PhrictionRemarkupRule

<<< OLD OBJECT RULE POSITION

200 PhabricatorIconRemarkupRule
200 PhabricatorMemeRemarkupRule
200 DivinerSymbolRemarkupRule
350 DoorkeeperRemarkupRuleJIRA
350 PhabricatorYoutubeRemarkupRule
350 DoorkeeperRemarkupRuleAsana
400 PhutilRemarkupHyperlinkRule

>>> NEW OBJECT RULE POSITION

500 PhabricatorImageMacroRemarkupRule
500 CustomInlineJIRA5Rule
500 PhabricatorMentionRemarkupRule
500 CustomInlineCodeRule
1000 PhutilRemarkupDelRule
1000 PhutilRemarkupBoldRule
1000 PhutilRemarkupItalicRule
1000 PhutilRemarkupUnderlineRule

- The disadvantage of this approach is that `{F123, alt=go look at http://lol.com/ omg}` will parse the URL first, and then fail to resolve the object embed. This seems very rare / unusual.
- The advantage is that all URLs which happen to have monograms in them work.

In the future, we could refine this by separating the rules, so the embed (`{...}`) versions fired at priority 200, while the normal versions fired at priority 450. We can wait for use cases, though. This is a little messy because the same code implements both rules.

Test Plan:
- Verified example in T5837.
- Marked up object rules like `F123` (works), `[[ asdf | F123 ]]` (works), `{F123, alt=http://example.com}` (does not work).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5837

Differential Revision: https://secure.phabricator.com/D10212

+2 -4
+2 -4
src/infrastructure/markup/rule/PhabricatorObjectRemarkupRule.php
··· 9 9 abstract protected function loadObjects(array $ids); 10 10 11 11 public function getPriority() { 12 - return 200.0; 12 + return 450.0; 13 13 } 14 14 15 15 protected function getObjectNamePrefixBeginsWithWordCharacter() { ··· 116 116 } 117 117 118 118 // NOTE: The "(?<!#)" prevents us from linking "#abcdef" or similar. 119 - // The "(?<!/)" prevents us from linking things in URIs. 120 - // The "(?<!;)" prevents linking Diffusion URIs to commits. 121 119 // The "\b" allows us to link "(abcdef)" or similar without linking things 122 120 // in the middle of words. 123 121 124 122 $text = preg_replace_callback( 125 - '((?<!#)(?<!/)(?<!;)'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?\b)', 123 + '((?<!#)'.$boundary.$prefix.'('.$id.')(?:#([-\w\d]+))?\b)', 126 124 array($this, 'markupObjectReference'), 127 125 $text); 128 126