Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "First first run wizzard" #33556

Merged
merged 3 commits into from
Aug 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions apps/theming/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,4 @@
--primary-invert-if-bright: no;
--background-invert-if-dark: no;
--background-invert-if-bright: invert(100%);
--image-logo: url('/core/img/logo/logo.png?v=0');
--image-logoheader: url('/core/img/logo/logo.png?v=0');
--image-favicon: url('/core/img/logo/logo.png?v=0');
--image-background-size: cover;
--image-background: url('/core/img/background.png?v=0');
--image-login-background: url('/core/img/background.png?v=0');
}
25 changes: 17 additions & 8 deletions apps/theming/lib/Themes/DefaultTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public function getCSSVariables(): array {
$colorPrimaryLight = $this->util->mix($this->primaryColor, $colorMainBackground, -80);

$hasCustomLogoHeader = $this->imageManager->hasImage('logo') || $this->imageManager->hasImage('logoheader');
$hasCustomPrimaryColour = !empty($this->config->getAppValue('theming', 'color'));

$variables = [
'--color-main-background' => $colorMainBackground,
Expand Down Expand Up @@ -192,17 +193,25 @@ public function getCSSVariables(): array {
];

$backgroundDeleted = $this->config->getAppValue('theming', 'backgroundMime', '') === 'backgroundColor';
// If primary as background has been request or if we have a custom primary colour
// let's not define the background image
if ($backgroundDeleted || $hasCustomPrimaryColour) {
$variables["--image-background-plain"] = 'true';
}

// Register image variables only if custom-defined
foreach(['logo', 'logoheader', 'favicon', 'background'] as $image) {
// If primary as background has been request, let's not define the background image
if ($image === 'background' && $backgroundDeleted) {
$variables["--image-background-plain"] = 'true';
continue;
} else if ($image === 'background') {
$variables['--image-background-size'] = 'cover';
if ($this->imageManager->hasImage($image)) {
if ($image === 'background') {
// If background deleted is set, ignoring variable
if ($backgroundDeleted) {
continue;
}
$variables['--image-background-size'] = 'cover';
}
$variables["--image-$image"] = "url('".$this->imageManager->getImageUrl($image)."')";
}
$variables["--image-$image"] = "url('".$this->imageManager->getImageUrl($image)."')";
}
$variables["--image-login-background"] = $variables["--image-background"];

if ($hasCustomLogoHeader) {
$variables["--image-logoheader-custom"] = 'true';
Expand Down
2 changes: 1 addition & 1 deletion apps/theming/tests/ImageManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public function testCleanup() {
foreach ($folders as $index => $folder) {
$folder->expects($this->any())
->method('getName')
->willReturn((string)$index);
->willReturn("$index");
}
$folders[0]->expects($this->once())->method('delete');
$folders[1]->expects($this->once())->method('delete');
Expand Down
19 changes: 1 addition & 18 deletions apps/theming/tests/Themes/DefaultThemeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Theming\Tests;
namespace OCA\Theming\Tests\Service;

use OC\App\AppManager;
use OCA\Theming\ImageManager;
Expand Down Expand Up @@ -68,23 +68,6 @@ protected function setUp(): void {
->method('getColorPrimary')
->willReturn('#0082c9');

$this->imageManager->expects($this->any())
->method('getImageUrl')
->willReturnCallback(function (string $name): string {
switch ($name) {
case 'logo':
case 'logoheader':
case 'favicon':
return '/core/img/logo/logo.png?v=0';
case 'background':
case 'login-background':
return '/core/img/background.png?v=0';
default:
return '';
}
});


$this->l10n
->expects($this->any())
->method('t')
Expand Down