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

Improve some Phame custom domain remarkup and link behaviors

Summary:
Ref T6299. This makes more of the links point to the right places.

Not covered yet:

- Projects and subscribers don't point to the right place (this is a little tricky to fix, I think).
- `[[ #anchor ]]`s won't do the right thing in, uh, email, I guess, since `uri.here` is not set. This is also a little tricky.

Possibly we should just remove subscribers (although also kind of tricky).

Test Plan: On a custom-domain blog, observed that fewer things were broken.

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T6299

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

+40 -11
+4
src/applications/people/markup/PhabricatorMentionRemarkupRule.php
··· 136 136 ), 137 137 '@'.$user->getUserName()); 138 138 } else { 139 + if ($engine->getConfig('uri.full')) { 140 + $user_href = PhabricatorEnv::getURI($user_href); 141 + } 142 + 139 143 $tag = id(new PHUITagView()) 140 144 ->setType(PHUITagView::TYPE_PERSON) 141 145 ->setPHID($user->getPHID())
+8 -4
src/applications/phame/controller/post/PhamePostViewController.php
··· 78 78 ->executeOne(); 79 79 $blogger_profile = $blogger->loadUserProfile(); 80 80 81 + 82 + $author_uri = '/p/'.$blogger->getUsername().'/'; 83 + $author_uri = PhabricatorEnv::getURI($author_uri); 84 + 81 85 $author = phutil_tag( 82 86 'a', 83 87 array( 84 - 'href' => '/p/'.$blogger->getUsername().'/', 88 + 'href' => $author_uri, 85 89 ), 86 90 $blogger->getUsername()); 87 91 ··· 105 109 $blogger_profile->getTitle(), 106 110 )) 107 111 ->setImage($blogger->getProfileImageURI()) 108 - ->setImageHref('/p/'.$blogger->getUsername()); 112 + ->setImageHref($author_uri); 109 113 110 114 $timeline = $this->buildTransactionTimeline( 111 115 $post, ··· 128 132 129 133 $next_view = new PhameNextPostView(); 130 134 if ($next) { 131 - $next_view->setNext($next->getTitle(), $next->getViewURI()); 135 + $next_view->setNext($next->getTitle(), $next->getLiveURI()); 132 136 } 133 137 if ($prev) { 134 - $next_view->setPrevious($prev->getTitle(), $prev->getViewURI()); 138 + $next_view->setPrevious($prev->getTitle(), $prev->getLiveURI()); 135 139 } 136 140 137 141 $document->setFoot($next_view);
+12 -2
src/applications/phame/view/PhamePostListView.php
··· 62 62 63 63 $list = array(); 64 64 foreach ($posts as $post) { 65 - $blogger = $handles[$post->getBloggerPHID()]->renderLink(); 65 + $blogger_name = $handles[$post->getBloggerPHID()]->getName(); 66 66 $blogger_uri = $handles[$post->getBloggerPHID()]->getURI(); 67 + $blogger_uri = PhabricatorEnv::getURI($blogger_uri); 68 + 69 + // Render a link manually to make sure we point at the correct domain. 70 + $blogger = phutil_tag( 71 + 'a', 72 + array( 73 + 'href' => $blogger_uri, 74 + ), 75 + $blogger_name); 76 + $blogger = phutil_tag('strong', array(), $blogger); 77 + 67 78 $blogger_image = $handles[$post->getBloggerPHID()]->getImageURI(); 68 79 69 80 $phame_post = null; ··· 74 85 $phame_post = phutil_tag('em', array(), pht('(Empty Post)')); 75 86 } 76 87 77 - $blogger = phutil_tag('strong', array(), $blogger); 78 88 $date = phabricator_datetime($post->getDatePublished(), $viewer); 79 89 80 90 $blog = $post->getBlog();
+15 -4
src/infrastructure/markup/PhabricatorMarkupEngine.php
··· 351 351 * @task engine 352 352 */ 353 353 public static function newPhameMarkupEngine() { 354 - return self::newMarkupEngine(array( 355 - 'macros' => false, 356 - 'uri.full' => true, 357 - )); 354 + return self::newMarkupEngine( 355 + array( 356 + 'macros' => false, 357 + 'uri.full' => true, 358 + 'uri.same-window' => true, 359 + 'uri.base' => PhabricatorEnv::getURI('/'), 360 + )); 358 361 } 359 362 360 363 ··· 486 489 $engine->setConfig('phutil.codeblock.style-map', $style_map); 487 490 488 491 $engine->setConfig('uri.full', $options['uri.full']); 492 + 493 + if (isset($options['uri.base'])) { 494 + $engine->setConfig('uri.base', $options['uri.base']); 495 + } 496 + 497 + if (isset($options['uri.same-window'])) { 498 + $engine->setConfig('uri.same-window', $options['uri.same-window']); 499 + } 489 500 490 501 $rules = array(); 491 502 $rules[] = new PhutilRemarkupEscapeRemarkupRule();
+1 -1
src/infrastructure/markup/view/PHUIRemarkupView.php
··· 82 82 $engine_key = PhabricatorHash::digestForIndex($engine_key); 83 83 84 84 $cache = PhabricatorCaches::getRequestCache(); 85 - $cache_key = "remarkup.engine({$viewer}, {$engine_key})"; 85 + $cache_key = "remarkup.engine({$viewer_key}, {$engine_key})"; 86 86 87 87 $engine = $cache->getKey($cache_key); 88 88 if (!$engine) {