Skip to content

Commit

Permalink
fix getAppValue default value in theming app
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Veyssier <[email protected]>
  • Loading branch information
Julien Veyssier committed Nov 3, 2020
1 parent 7586743 commit 282bcf7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions apps/theming/lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function __construct(ThemingDefaults $theming, Util $util, IURLGenerator
* @return array
*/
public function getCapabilities() {
$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', false);
$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', '');
$color = $this->theming->getColorPrimary();
return [
'theming' => [
Expand All @@ -82,10 +82,10 @@ public function getCapabilities() {
'color-element-bright' => $this->util->elementColor($color),
'color-element-dark' => $this->util->elementColor($color, false),
'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()),
'background' => $backgroundLogo === 'backgroundColor' || ($backgroundLogo === false && $this->theming->getColorPrimary() !== '#0082c9') ?
'background' => $backgroundLogo === 'backgroundColor' || ($backgroundLogo === '' && $this->theming->getColorPrimary() !== '#0082c9') ?
$this->theming->getColorPrimary() :
$this->url->getAbsoluteURL($this->theming->getBackground()),
'background-plain' => $backgroundLogo === 'backgroundColor' || ($backgroundLogo === false && $this->theming->getColorPrimary() !== '#0082c9'),
'background-plain' => $backgroundLogo === 'backgroundColor' || ($backgroundLogo === '' && $this->theming->getColorPrimary() !== '#0082c9'),
'background-default' => !$this->util->isBackgroundThemed(),
'logoheader' => $this->url->getAbsoluteURL($this->theming->getLogo()),
'favicon' => $this->url->getAbsoluteURL($this->theming->getLogo()),
Expand Down
4 changes: 2 additions & 2 deletions apps/theming/lib/ImageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ public function getImageUrlAbsolute(string $key, bool $useSvg = true): string {
*/
public function getImage(string $key, bool $useSvg = true): ISimpleFile {
$pngFile = null;
$logo = $this->config->getAppValue('theming', $key . 'Mime', false);
$logo = $this->config->getAppValue('theming', $key . 'Mime', '');
$folder = $this->appData->getFolder('images');
if ($logo === false || !$folder->fileExists($key)) {
if ($logo === '' || !$folder->fileExists($key)) {
throw new NotFoundException();
}
if (!$useSvg && $this->shouldReplaceIcons()) {
Expand Down
8 changes: 4 additions & 4 deletions apps/theming/lib/ThemingDefaults.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function getColorPrimary() {
* @return string
*/
public function getLogo($useSvg = true): string {
$logo = $this->config->getAppValue('theming', 'logoMime', false);
$logo = $this->config->getAppValue('theming', 'logoMime', '');

$logoExists = true;
try {
Expand Down Expand Up @@ -307,17 +307,17 @@ public function getScssVariables() {
$variables['image-login-plain'] = 'false';
$variables['image-dashboard-plain'] = 'false';

if ($this->config->getAppValue('theming', 'color', null) !== null) {
if ($this->config->getAppValue('theming', 'color', '') !== '') {
$variables['color-primary'] = $this->getColorPrimary();
$variables['color-primary-text'] = $this->getTextColorPrimary();
$variables['color-primary-element'] = $this->util->elementColor($this->getColorPrimary());
}

if ($this->config->getAppValue('theming', 'backgroundMime', null) === 'backgroundColor') {
if ($this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor') {
$variables['image-login-plain'] = 'true';
}

if ($this->config->getAppValue('theming', 'dashboardBackgroundMime', null) === 'backgroundColor') {
if ($this->config->getAppValue('theming', 'dashboardBackgroundMime', '') === 'backgroundColor') {
$variables['image-dashboard-plain'] = 'true';
}

Expand Down
2 changes: 1 addition & 1 deletion apps/theming/lib/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public function isAlreadyThemed() {
}

public function isBackgroundThemed() {
$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime',false);
$backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime', '');

$backgroundExists = true;
try {
Expand Down

0 comments on commit 282bcf7

Please sign in to comment.