mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-25 16:22:43 +01:00
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
This commit is contained in:
parent
c3d6c4b0ee
commit
49b57eae7d
6 changed files with 31 additions and 94 deletions
|
@ -292,7 +292,6 @@ return array(
|
|||
'rsrc/favicons/mstile-310x150.png' => '4a49d3ee',
|
||||
'rsrc/favicons/mstile-310x310.png' => 'a52ab264',
|
||||
'rsrc/favicons/mstile-70x70.png' => '5edce7b8',
|
||||
'rsrc/favicons/opengraph-144x144.png' => '648fb0fc',
|
||||
'rsrc/image/BFCFDA.png' => 'd5ec91f4',
|
||||
'rsrc/image/actions/edit.png' => '2fc41442',
|
||||
'rsrc/image/avatar.png' => '17d346a4',
|
||||
|
|
|
@ -13,39 +13,6 @@ final class PhabricatorCustomLogoConfigType
|
|||
return idx($logo, 'wordmarkText');
|
||||
}
|
||||
|
||||
public static function getLogoURI(PhabricatorUser $viewer) {
|
||||
$logo_uri = null;
|
||||
|
||||
$custom_header = self::getLogoImagePHID();
|
||||
if ($custom_header) {
|
||||
$cache = PhabricatorCaches::getImmutableCache();
|
||||
$cache_key_logo = 'ui.custom-header.logo-phid.v3.'.$custom_header;
|
||||
$logo_uri = $cache->getKey($cache_key_logo);
|
||||
|
||||
if (!$logo_uri) {
|
||||
// NOTE: If the file policy has been changed to be restrictive, we'll
|
||||
// miss here and just show the default logo. The cache will fill later
|
||||
// when someone who can see the file loads the page. This might be a
|
||||
// little spooky, see T11982.
|
||||
$files = id(new PhabricatorFileQuery())
|
||||
->setViewer($viewer)
|
||||
->withPHIDs(array($custom_header))
|
||||
->execute();
|
||||
$file = head($files);
|
||||
if ($file) {
|
||||
$logo_uri = $file->getViewURI();
|
||||
$cache->setKey($cache_key_logo, $logo_uri);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$logo_uri) {
|
||||
$logo_uri = celerity_get_resource_uri('/rsrc/image/logo/light-eye.png');
|
||||
}
|
||||
|
||||
return $logo_uri;
|
||||
}
|
||||
|
||||
public function validateOption(PhabricatorConfigOption $option, $value) {
|
||||
if (!is_array($value)) {
|
||||
throw new Exception(
|
||||
|
|
|
@ -59,15 +59,9 @@ abstract class AphrontPageView extends AphrontView {
|
|||
),
|
||||
array($body, $tail));
|
||||
|
||||
if (PhabricatorEnv::getEnvConfig('policy.allow-public')) {
|
||||
$html_open_tag = hsprintf('<html prefix="og: http://ogp.me/ns#">');
|
||||
} else {
|
||||
$html_open_tag = hsprintf('<html>');
|
||||
}
|
||||
|
||||
$response = hsprintf(
|
||||
'<!DOCTYPE html>'.
|
||||
'%s'.
|
||||
'<html>'.
|
||||
'<head>'.
|
||||
'<meta charset="UTF-8" />'.
|
||||
'<title>%s</title>'.
|
||||
|
@ -75,7 +69,6 @@ abstract class AphrontPageView extends AphrontView {
|
|||
'</head>'.
|
||||
'%s'.
|
||||
'</html>',
|
||||
$html_open_tag,
|
||||
$title,
|
||||
$head,
|
||||
$body);
|
||||
|
|
|
@ -426,11 +426,10 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView
|
|||
}
|
||||
|
||||
return hsprintf(
|
||||
'%s%s%s%s',
|
||||
'%s%s%s',
|
||||
parent::getHead(),
|
||||
$font_css,
|
||||
$response->renderSingleResource('javelin-magical-init', 'phabricator'),
|
||||
$this->newOpenGraphTags());
|
||||
$response->renderSingleResource('javelin-magical-init', 'phabricator'));
|
||||
}
|
||||
|
||||
public function setGlyph($glyph) {
|
||||
|
@ -912,45 +911,4 @@ final class PhabricatorStandardPageView extends PhabricatorBarePageView
|
|||
return $response;
|
||||
}
|
||||
|
||||
private function newOpenGraphTags() {
|
||||
// If we don't allow public access, there's no point in emitting OpenGraph
|
||||
// tags because external systems can't fetch pages.
|
||||
if (!PhabricatorEnv::getEnvConfig('policy.allow-public')) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$viewer = $this->getViewer();
|
||||
|
||||
$properties = array(
|
||||
array(
|
||||
'og:title',
|
||||
$this->getTitle(),
|
||||
),
|
||||
array(
|
||||
'og:type',
|
||||
'website',
|
||||
),
|
||||
array(
|
||||
'og:url',
|
||||
PhabricatorEnv::getProductionURI($this->getRequest()->getRequestURI()),
|
||||
),
|
||||
array(
|
||||
'og:image',
|
||||
celerity_get_resource_uri('rsrc/favicons/opengraph-144x144.png'),
|
||||
),
|
||||
);
|
||||
|
||||
$tags = array();
|
||||
foreach ($properties as $property) {
|
||||
$tags[] = phutil_tag(
|
||||
'meta',
|
||||
array(
|
||||
'property' => $property[0],
|
||||
'content' => $property[1],
|
||||
));
|
||||
}
|
||||
|
||||
return $tags;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -262,16 +262,35 @@ final class PhabricatorMainMenuView extends AphrontView {
|
|||
}
|
||||
|
||||
private function renderPhabricatorLogo() {
|
||||
$logo_style = array();
|
||||
|
||||
$custom_header = PhabricatorCustomLogoConfigType::getLogoImagePHID();
|
||||
if ($custom_header) {
|
||||
$viewer = $this->getViewer();
|
||||
$logo_uri = PhabricatorCustomLogoConfigType::getLogoURI($viewer);
|
||||
|
||||
$logo_style[] = 'background-size: 40px 40px;';
|
||||
$logo_style[] = 'background-position: 0 0;';
|
||||
$logo_style[] = 'background-image: url('.$logo_uri.')';
|
||||
$logo_style = array();
|
||||
if ($custom_header) {
|
||||
$cache = PhabricatorCaches::getImmutableCache();
|
||||
$cache_key_logo = 'ui.custom-header.logo-phid.v3.'.$custom_header;
|
||||
|
||||
$logo_uri = $cache->getKey($cache_key_logo);
|
||||
if (!$logo_uri) {
|
||||
// NOTE: If the file policy has been changed to be restrictive, we'll
|
||||
// miss here and just show the default logo. The cache will fill later
|
||||
// when someone who can see the file loads the page. This might be a
|
||||
// little spooky, see T11982.
|
||||
$files = id(new PhabricatorFileQuery())
|
||||
->setViewer($this->getViewer())
|
||||
->withPHIDs(array($custom_header))
|
||||
->execute();
|
||||
$file = head($files);
|
||||
if ($file) {
|
||||
$logo_uri = $file->getViewURI();
|
||||
$cache->setKey($cache_key_logo, $logo_uri);
|
||||
}
|
||||
}
|
||||
|
||||
if ($logo_uri) {
|
||||
$logo_style[] = 'background-size: 40px 40px;';
|
||||
$logo_style[] = 'background-position: 0 0;';
|
||||
$logo_style[] = 'background-image: url('.$logo_uri.')';
|
||||
}
|
||||
}
|
||||
|
||||
$logo_node = phutil_tag(
|
||||
|
@ -281,6 +300,7 @@ final class PhabricatorMainMenuView extends AphrontView {
|
|||
'style' => implode(' ', $logo_style),
|
||||
));
|
||||
|
||||
|
||||
$wordmark_text = PhabricatorCustomLogoConfigType::getLogoWordmark();
|
||||
if (!strlen($wordmark_text)) {
|
||||
$wordmark_text = pht('Phabricator');
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
Loading…
Reference in a new issue