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

Revert partial/nonfunctional OpenGraph support

Summary:
Ref T13018. See that task and the Discourse thread for discussion.

This doesn't work as-is and we need to `og:description` everything to make it work. I don't want to sink any more time into this so just back all the changes out for now.

(The `<html>` change is unnecessary anyway.)

Test Plan: Strict revert.

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13018

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

+30 -93
-1
resources/celerity/map.php
··· 292 292 'rsrc/favicons/mstile-310x150.png' => '4a49d3ee', 293 293 'rsrc/favicons/mstile-310x310.png' => 'a52ab264', 294 294 'rsrc/favicons/mstile-70x70.png' => '5edce7b8', 295 - 'rsrc/favicons/opengraph-144x144.png' => '648fb0fc', 296 295 'rsrc/image/BFCFDA.png' => 'd5ec91f4', 297 296 'rsrc/image/actions/edit.png' => '2fc41442', 298 297 'rsrc/image/avatar.png' => '17d346a4',
-33
src/applications/config/custom/PhabricatorCustomLogoConfigType.php
··· 13 13 return idx($logo, 'wordmarkText'); 14 14 } 15 15 16 - public static function getLogoURI(PhabricatorUser $viewer) { 17 - $logo_uri = null; 18 - 19 - $custom_header = self::getLogoImagePHID(); 20 - if ($custom_header) { 21 - $cache = PhabricatorCaches::getImmutableCache(); 22 - $cache_key_logo = 'ui.custom-header.logo-phid.v3.'.$custom_header; 23 - $logo_uri = $cache->getKey($cache_key_logo); 24 - 25 - if (!$logo_uri) { 26 - // NOTE: If the file policy has been changed to be restrictive, we'll 27 - // miss here and just show the default logo. The cache will fill later 28 - // when someone who can see the file loads the page. This might be a 29 - // little spooky, see T11982. 30 - $files = id(new PhabricatorFileQuery()) 31 - ->setViewer($viewer) 32 - ->withPHIDs(array($custom_header)) 33 - ->execute(); 34 - $file = head($files); 35 - if ($file) { 36 - $logo_uri = $file->getViewURI(); 37 - $cache->setKey($cache_key_logo, $logo_uri); 38 - } 39 - } 40 - } 41 - 42 - if (!$logo_uri) { 43 - $logo_uri = celerity_get_resource_uri('/rsrc/image/logo/light-eye.png'); 44 - } 45 - 46 - return $logo_uri; 47 - } 48 - 49 16 public function validateOption(PhabricatorConfigOption $option, $value) { 50 17 if (!is_array($value)) { 51 18 throw new Exception(
+1 -8
src/view/page/AphrontPageView.php
··· 59 59 ), 60 60 array($body, $tail)); 61 61 62 - if (PhabricatorEnv::getEnvConfig('policy.allow-public')) { 63 - $html_open_tag = hsprintf('<html prefix="og: http://ogp.me/ns#">'); 64 - } else { 65 - $html_open_tag = hsprintf('<html>'); 66 - } 67 - 68 62 $response = hsprintf( 69 63 '<!DOCTYPE html>'. 70 - '%s'. 64 + '<html>'. 71 65 '<head>'. 72 66 '<meta charset="UTF-8" />'. 73 67 '<title>%s</title>'. ··· 75 69 '</head>'. 76 70 '%s'. 77 71 '</html>', 78 - $html_open_tag, 79 72 $title, 80 73 $head, 81 74 $body);
+2 -44
src/view/page/PhabricatorStandardPageView.php
··· 426 426 } 427 427 428 428 return hsprintf( 429 - '%s%s%s%s', 429 + '%s%s%s', 430 430 parent::getHead(), 431 431 $font_css, 432 - $response->renderSingleResource('javelin-magical-init', 'phabricator'), 433 - $this->newOpenGraphTags()); 432 + $response->renderSingleResource('javelin-magical-init', 'phabricator')); 434 433 } 435 434 436 435 public function setGlyph($glyph) { ··· 910 909 } 911 910 912 911 return $response; 913 - } 914 - 915 - private function newOpenGraphTags() { 916 - // If we don't allow public access, there's no point in emitting OpenGraph 917 - // tags because external systems can't fetch pages. 918 - if (!PhabricatorEnv::getEnvConfig('policy.allow-public')) { 919 - return array(); 920 - } 921 - 922 - $viewer = $this->getViewer(); 923 - 924 - $properties = array( 925 - array( 926 - 'og:title', 927 - $this->getTitle(), 928 - ), 929 - array( 930 - 'og:type', 931 - 'website', 932 - ), 933 - array( 934 - 'og:url', 935 - PhabricatorEnv::getProductionURI($this->getRequest()->getRequestURI()), 936 - ), 937 - array( 938 - 'og:image', 939 - celerity_get_resource_uri('rsrc/favicons/opengraph-144x144.png'), 940 - ), 941 - ); 942 - 943 - $tags = array(); 944 - foreach ($properties as $property) { 945 - $tags[] = phutil_tag( 946 - 'meta', 947 - array( 948 - 'property' => $property[0], 949 - 'content' => $property[1], 950 - )); 951 - } 952 - 953 - return $tags; 954 912 } 955 913 956 914 }
+27 -7
src/view/page/menu/PhabricatorMainMenuView.php
··· 262 262 } 263 263 264 264 private function renderPhabricatorLogo() { 265 + $custom_header = PhabricatorCustomLogoConfigType::getLogoImagePHID(); 266 + 265 267 $logo_style = array(); 266 - 267 - $custom_header = PhabricatorCustomLogoConfigType::getLogoImagePHID(); 268 268 if ($custom_header) { 269 - $viewer = $this->getViewer(); 270 - $logo_uri = PhabricatorCustomLogoConfigType::getLogoURI($viewer); 269 + $cache = PhabricatorCaches::getImmutableCache(); 270 + $cache_key_logo = 'ui.custom-header.logo-phid.v3.'.$custom_header; 271 271 272 - $logo_style[] = 'background-size: 40px 40px;'; 273 - $logo_style[] = 'background-position: 0 0;'; 274 - $logo_style[] = 'background-image: url('.$logo_uri.')'; 272 + $logo_uri = $cache->getKey($cache_key_logo); 273 + if (!$logo_uri) { 274 + // NOTE: If the file policy has been changed to be restrictive, we'll 275 + // miss here and just show the default logo. The cache will fill later 276 + // when someone who can see the file loads the page. This might be a 277 + // little spooky, see T11982. 278 + $files = id(new PhabricatorFileQuery()) 279 + ->setViewer($this->getViewer()) 280 + ->withPHIDs(array($custom_header)) 281 + ->execute(); 282 + $file = head($files); 283 + if ($file) { 284 + $logo_uri = $file->getViewURI(); 285 + $cache->setKey($cache_key_logo, $logo_uri); 286 + } 287 + } 288 + 289 + if ($logo_uri) { 290 + $logo_style[] = 'background-size: 40px 40px;'; 291 + $logo_style[] = 'background-position: 0 0;'; 292 + $logo_style[] = 'background-image: url('.$logo_uri.')'; 293 + } 275 294 } 276 295 277 296 $logo_node = phutil_tag( ··· 280 299 'class' => 'phabricator-main-menu-eye', 281 300 'style' => implode(' ', $logo_style), 282 301 )); 302 + 283 303 284 304 $wordmark_text = PhabricatorCustomLogoConfigType::getLogoWordmark(); 285 305 if (!strlen($wordmark_text)) {
webroot/rsrc/favicons/opengraph-144x144.png

This is a binary file and will not be displayed.