Cleanup theming mess

* Do not do translations in the constructor. This gets called to early
so there is no user yet. Which means we can't obtain the locale. Which
means we store the wrong translation instance.

* Same for the theming app magic. Just use the parent call when needed.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2019-10-25 13:31:19 +02:00 committed by Backportbot
parent 70fea997af
commit 4dc91420cf
2 changed files with 5 additions and 6 deletions

View File

@ -70,8 +70,6 @@ class ThemingDefaults extends \OC_Defaults {
/** @var string */
private $url;
/** @var string */
private $slogan;
/** @var string */
private $color;
/** @var string */
@ -115,7 +113,6 @@ class ThemingDefaults extends \OC_Defaults {
$this->title = parent::getTitle();
$this->entity = parent::getEntity();
$this->url = parent::getBaseUrl();
$this->slogan = parent::getSlogan();
$this->color = parent::getColorPrimary();
$this->iTunesAppId = parent::getiTunesAppId();
$this->iOSClientUrl = parent::getiOSClientUrl();
@ -143,7 +140,7 @@ class ThemingDefaults extends \OC_Defaults {
}
public function getSlogan() {
return \OCP\Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', $this->slogan));
return \OCP\Util::sanitizeHTML($this->config->getAppValue('theming', 'slogan', parent::getSlogan()));
}
public function getImprintUrl() {

View File

@ -52,7 +52,6 @@ class OC_Defaults {
private $defaultTextColorPrimary;
public function __construct() {
$l10n = \OC::$server->getL10N('lib');
$config = \OC::$server->getConfig();
$this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */
@ -65,7 +64,6 @@ class OC_Defaults {
$this->defaultAndroidClientUrl = $config->getSystemValue('customclient_android', 'https://play.google.com/store/apps/details?id=com.nextcloud.client');
$this->defaultDocBaseUrl = 'https://docs.nextcloud.com';
$this->defaultDocVersion = \OC_Util::getVersion()[0]; // used to generate doc links
$this->defaultSlogan = $l10n->t('a safe home for all your data');
$this->defaultColorPrimary = '#0082c9';
$this->defaultTextColorPrimary = '#ffffff';
@ -219,6 +217,10 @@ class OC_Defaults {
if ($this->themeExist('getSlogan')) {
return $this->theme->getSlogan();
} else {
if ($this->defaultSlogan === null) {
$l10n = \OC::$server->getL10N('lib');
$this->defaultSlogan = $l10n->t('a safe home for all your data');
}
return $this->defaultSlogan;
}
}