@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.

When marking up Phurl URLs for mail, use absolute URLs

Summary: Fixes T10625.

Test Plan: Faked this locallly and it looked OK, I'll check the mail in production. :3333

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T10625

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

+28 -27
+28 -27
src/applications/phurl/remarkup/PhabricatorPhurlLinkRemarkupRule.php
··· 18 18 public function markupLink(array $matches) { 19 19 $engine = $this->getEngine(); 20 20 $viewer = $engine->getConfig('viewer'); 21 + 21 22 $text_mode = $engine->isTextMode(); 23 + $html_mode = $engine->isHTMLMailMode(); 22 24 23 25 if (!$this->isFlatText($matches[0])) { 24 26 return $matches[0]; ··· 28 30 $monogram = null; 29 31 $is_monogram = '/^U(?P<id>[1-9]\d*)/'; 30 32 33 + $query = id(new PhabricatorPhurlURLQuery()) 34 + ->setViewer($viewer); 35 + 31 36 if (preg_match($is_monogram, $ref, $monogram)) { 32 - $phurls = id(new PhabricatorPhurlURLQuery()) 33 - ->setViewer($viewer) 34 - ->withIDs(array($monogram[1])) 35 - ->execute(); 37 + $query->withIDs(array($monogram[1])); 36 38 } else if (ctype_digit($ref)) { 37 - $phurls = id(new PhabricatorPhurlURLQuery()) 38 - ->setViewer($viewer) 39 - ->withIDs(array($ref)) 40 - ->execute(); 39 + $query->withIDs(array($ref)); 41 40 } else { 42 - $phurls = id(new PhabricatorPhurlURLQuery()) 43 - ->setViewer($viewer) 44 - ->withAliases(array($ref)) 45 - ->execute(); 41 + $query->withAliases(array($ref)); 46 42 } 47 43 48 - $phurl = head($phurls); 44 + $phurl = $query->executeOne(); 45 + if (!$phurl) { 46 + return $matches[0]; 47 + } 48 + 49 + $uri = $phurl->getRedirectURI(); 50 + $name = $phurl->getDisplayName(); 49 51 50 - if ($phurl) { 51 - if ($text_mode) { 52 - return $phurl->getDisplayName(). 53 - ' <'. 54 - $phurl->getRedirectURI(). 55 - '>'; 56 - } 52 + if ($text_mode || $html_mode) { 53 + $uri = PhabricatorEnv::getProductionURI($uri); 54 + } 57 55 56 + if ($text_mode) { 57 + return pht( 58 + '%s <%s>', 59 + $name, 60 + $uri); 61 + } else { 58 62 $link = phutil_tag( 59 63 'a', 60 64 array( 61 - 'href' => $phurl->getRedirectURI(), 65 + 'href' => $uri, 62 66 'target' => '_blank', 63 67 ), 64 - $phurl->getDisplayName()); 68 + $name); 69 + } 65 70 66 - return $this->getEngine()->storeText($link); 67 - } else { 68 - return $matches[0]; 69 - } 71 + return $this->getEngine()->storeText($link); 70 72 } 71 - 72 73 73 74 }