mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
When a custom logo is configured but has a restrictive visibility policy, fall back to the default logo
Summary: Fixes T11982. Currently, configuring a custom logo and then setting the policy restrictively locks off the whole install. Test Plan: - Configured `ui.logo`. - Searched for the file PHID in global search to find the underlying file. - Set the policy to something restrictive ("only me"). - Purged cache (`bin/cache purge --purge-all`). - Restarted webserver to nuke APC. - Loaded a page as a different user. - Before change: policy exception while trying to load the logo. - After change: fallback to default logo. - Loaded page as user who can see the logo, got custom logo. Reviewers: chad Reviewed By: chad Maniphest Tasks: T11982 Differential Revision: https://secure.phabricator.com/D17011
This commit is contained in:
parent
ffdc082852
commit
cde37acb4b
1 changed files with 12 additions and 5 deletions
|
@ -317,19 +317,26 @@ final class PhabricatorMainMenuView extends AphrontView {
|
|||
|
||||
$logo_uri = $cache->getKey($cache_key_logo);
|
||||
if (!$logo_uri) {
|
||||
$file = id(new PhabricatorFileQuery())
|
||||
// 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))
|
||||
->executeOne();
|
||||
->execute();
|
||||
$file = head($files);
|
||||
if ($file) {
|
||||
$logo_uri = $file->getViewURI();
|
||||
$cache->setKey($cache_key_logo, $logo_uri);
|
||||
}
|
||||
}
|
||||
|
||||
$logo_style[] = 'background-size: 40px 40px;';
|
||||
$logo_style[] = 'background-position: 0 0;';
|
||||
$logo_style[] = 'background-image: url('.$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(
|
||||
|
|
Loading…
Reference in a new issue