mirror of
https://github.com/nextcloud/server.git
synced 2025-05-12 17:42:35 +00:00
fix(mail): use matching text color for primary elements
when we use the default primary as background color we have to use the default primary text color as well. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
253a741013
commit
8f8c11ad4e
3 changed files with 44 additions and 32 deletions
apps/settings/tests/Mailer
lib/private/Mail
tests/lib/Mail
|
@ -146,8 +146,12 @@ class NewUserMailHelperTest extends TestCase {
|
|||
->method('getName')
|
||||
->willReturn('TestCloud');
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->method('getTextColorPrimary')
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultColorPrimary')
|
||||
->willReturn('#00679e');
|
||||
$this->defaults
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultTextColorPrimary')
|
||||
->willReturn('#ffffff');
|
||||
|
||||
$expectedHtmlBody = <<<EOF
|
||||
|
@ -175,7 +179,7 @@ class NewUserMailHelperTest extends TestCase {
|
|||
<table class="row collapse" style="border-collapse:collapse;border-spacing:0;display:table;padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
|
||||
<tbody>
|
||||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<center data-parsed="" style="background-color:;min-width:175px;max-height:175px; padding:35px 0px;border-radius:200px">
|
||||
<center data-parsed="" style="background-color:#00679e;min-width:175px;max-height:175px; padding:35px 0px;border-radius:200px">
|
||||
<img class="logo float-center" src="" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none;max-height:105px;max-width:105px;width:auto;height:auto">
|
||||
</center>
|
||||
</tr>
|
||||
|
@ -260,13 +264,13 @@ class NewUserMailHelperTest extends TestCase {
|
|||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<th style="Margin:0;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left">
|
||||
<center data-parsed="" style="min-width:490px;width:100%">
|
||||
<table class="button btn default primary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;margin-right:15px;border-radius:8px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto;background:;background-color:;color:#fefefe;">
|
||||
<table class="button btn default primary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;margin-right:15px;border-radius:8px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto;background:#00679e;background-color:#00679e;color:#fefefe;">
|
||||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
|
||||
<table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
|
||||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid ;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
|
||||
<a href="https://example.com/resetPassword/MySuperLongSecureRandomToken" style="Margin:0;border:0 solid ;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;padding:8px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Set your password</a>
|
||||
<td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #00679e;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
|
||||
<a href="https://example.com/resetPassword/MySuperLongSecureRandomToken" style="Margin:0;border:0 solid #00679e;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;padding:8px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Set your password</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -382,8 +386,12 @@ EOF;
|
|||
->method('getName')
|
||||
->willReturn('TestCloud');
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->method('getTextColorPrimary')
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultColorPrimary')
|
||||
->willReturn('#00679e');
|
||||
$this->defaults
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultTextColorPrimary')
|
||||
->willReturn('#ffffff');
|
||||
|
||||
$expectedHtmlBody = <<<EOF
|
||||
|
@ -411,7 +419,7 @@ EOF;
|
|||
<table class="row collapse" style="border-collapse:collapse;border-spacing:0;display:table;padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
|
||||
<tbody>
|
||||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<center data-parsed="" style="background-color:;min-width:175px;max-height:175px; padding:35px 0px;border-radius:200px">
|
||||
<center data-parsed="" style="background-color:#00679e;min-width:175px;max-height:175px; padding:35px 0px;border-radius:200px">
|
||||
<img class="logo float-center" src="" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none;max-height:105px;max-width:105px;width:auto;height:auto">
|
||||
</center>
|
||||
</tr>
|
||||
|
@ -496,13 +504,13 @@ EOF;
|
|||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<th style="Margin:0;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left">
|
||||
<center data-parsed="" style="min-width:490px;width:100%">
|
||||
<table class="button btn default primary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;margin-right:15px;border-radius:8px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto;background:;background-color:;color:#fefefe;">
|
||||
<table class="button btn default primary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;margin-right:15px;border-radius:8px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto;background:#00679e;background-color:#00679e;color:#fefefe;">
|
||||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
|
||||
<table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
|
||||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid ;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
|
||||
<a href="https://example.com/" style="Margin:0;border:0 solid ;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;padding:8px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Go to TestCloud</a>
|
||||
<td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #00679e;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
|
||||
<a href="https://example.com/" style="Margin:0;border:0 solid #00679e;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;padding:8px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Go to TestCloud</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -622,8 +630,12 @@ EOF;
|
|||
->method('getName')
|
||||
->willReturn('TestCloud');
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->method('getTextColorPrimary')
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultColorPrimary')
|
||||
->willReturn('#00679e');
|
||||
$this->defaults
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultTextColorPrimary')
|
||||
->willReturn('#ffffff');
|
||||
|
||||
$expectedHtmlBody = <<<EOF
|
||||
|
@ -651,7 +663,7 @@ EOF;
|
|||
<table class="row collapse" style="border-collapse:collapse;border-spacing:0;display:table;padding:0;position:relative;text-align:left;vertical-align:top;width:100%">
|
||||
<tbody>
|
||||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<center data-parsed="" style="background-color:;min-width:175px;max-height:175px; padding:35px 0px;border-radius:200px">
|
||||
<center data-parsed="" style="background-color:#00679e;min-width:175px;max-height:175px; padding:35px 0px;border-radius:200px">
|
||||
<img class="logo float-center" src="" alt="TestCloud" align="center" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:none;margin:0 auto;outline:0;text-align:center;text-decoration:none;max-height:105px;max-width:105px;width:auto;height:auto">
|
||||
</center>
|
||||
</tr>
|
||||
|
@ -721,13 +733,13 @@ EOF;
|
|||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<th style="Margin:0;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;line-height:1.3;margin:0;padding:0;text-align:left">
|
||||
<center data-parsed="" style="min-width:490px;width:100%">
|
||||
<table class="button btn default primary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;margin-right:15px;border-radius:8px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto;background:;background-color:;color:#fefefe;">
|
||||
<table class="button btn default primary float-center" style="Margin:0 0 30px 0;border-collapse:collapse;border-spacing:0;display:inline-block;float:none;margin:0 0 30px 0;margin-right:15px;border-radius:8px;max-width:300px;padding:0;text-align:center;vertical-align:top;width:auto;background:#00679e;background-color:#00679e;color:#fefefe;">
|
||||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border-collapse:collapse!important;color:#0a0a0a;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
|
||||
<table style="border-collapse:collapse;border-spacing:0;padding:0;text-align:left;vertical-align:top;width:100%">
|
||||
<tr style="padding:0;text-align:left;vertical-align:top">
|
||||
<td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid ;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
|
||||
<a href="https://example.com/" style="Margin:0;border:0 solid ;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;padding:8px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Go to TestCloud</a>
|
||||
<td style="-moz-hyphens:auto;-webkit-hyphens:auto;Margin:0;border:0 solid #00679e;border-collapse:collapse!important;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:400;hyphens:auto;line-height:normal;margin:0;padding:0;text-align:left;vertical-align:top;word-wrap:break-word">
|
||||
<a href="https://example.com/" style="Margin:0;border:0 solid #00679e;color:#ffffff;display:inline-block;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen-Sans,Ubuntu,Cantarell,'Helvetica Neue',Arial,sans-serif;font-size:16px;font-weight:regular;line-height:normal;margin:0;padding:8px;text-align:left;outline:1px solid #ffffff;text-decoration:none">Go to TestCloud</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -523,7 +523,7 @@ EOF;
|
|||
$this->ensureBodyListClosed();
|
||||
|
||||
$color = $this->themingDefaults->getDefaultColorPrimary();
|
||||
$textColor = $this->themingDefaults->getTextColorPrimary();
|
||||
$textColor = $this->themingDefaults->getDefaultTextColorPrimary();
|
||||
|
||||
$this->htmlBody .= vsprintf($this->buttonGroup, [$color, $color, $urlLeft, $color, $textColor, $textColor, $textLeft, $urlRight, $textRight]);
|
||||
$this->plainBody .= PHP_EOL . $plainTextLeft . ': ' . $urlLeft . PHP_EOL;
|
||||
|
@ -554,7 +554,7 @@ EOF;
|
|||
}
|
||||
|
||||
$color = $this->themingDefaults->getDefaultColorPrimary();
|
||||
$textColor = $this->themingDefaults->getTextColorPrimary();
|
||||
$textColor = $this->themingDefaults->getDefaultTextColorPrimary();
|
||||
$this->htmlBody .= vsprintf($this->button, [$color, $color, $url, $color, $textColor, $textColor, $text]);
|
||||
|
||||
if ($plainText !== false) {
|
||||
|
|
|
@ -47,7 +47,7 @@ class EMailTemplateTest extends TestCase {
|
|||
|
||||
public function testEMailTemplateCustomFooter(): void {
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultColorPrimary')
|
||||
->willReturn('#0082c9');
|
||||
$this->defaults
|
||||
|
@ -59,8 +59,8 @@ class EMailTemplateTest extends TestCase {
|
|||
->method('getName')
|
||||
->willReturn('TestCloud');
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->method('getTextColorPrimary')
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultTextColorPrimary')
|
||||
->willReturn('#ffffff');
|
||||
$this->urlGenerator
|
||||
->expects($this->once())
|
||||
|
@ -88,7 +88,7 @@ class EMailTemplateTest extends TestCase {
|
|||
|
||||
public function testEMailTemplateDefaultFooter(): void {
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultColorPrimary')
|
||||
->willReturn('#0082c9');
|
||||
$this->defaults
|
||||
|
@ -104,8 +104,8 @@ class EMailTemplateTest extends TestCase {
|
|||
->method('getLogo')
|
||||
->willReturn('/img/logo-mail-header.png');
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->method('getTextColorPrimary')
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultTextColorPrimary')
|
||||
->willReturn('#ffffff');
|
||||
$this->urlGenerator
|
||||
->expects($this->once())
|
||||
|
@ -131,7 +131,7 @@ class EMailTemplateTest extends TestCase {
|
|||
|
||||
public function testEMailTemplateSingleButton(): void {
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultColorPrimary')
|
||||
->willReturn('#0082c9');
|
||||
$this->defaults
|
||||
|
@ -147,8 +147,8 @@ class EMailTemplateTest extends TestCase {
|
|||
->method('getLogo')
|
||||
->willReturn('/img/logo-mail-header.png');
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->method('getTextColorPrimary')
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultTextColorPrimary')
|
||||
->willReturn('#ffffff');
|
||||
$this->urlGenerator
|
||||
->expects($this->once())
|
||||
|
@ -176,7 +176,7 @@ class EMailTemplateTest extends TestCase {
|
|||
|
||||
public function testEMailTemplateAlternativePlainTexts(): void {
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultColorPrimary')
|
||||
->willReturn('#0082c9');
|
||||
$this->defaults
|
||||
|
@ -192,8 +192,8 @@ class EMailTemplateTest extends TestCase {
|
|||
->method('getLogo')
|
||||
->willReturn('/img/logo-mail-header.png');
|
||||
$this->defaults
|
||||
->expects($this->any())
|
||||
->method('getTextColorPrimary')
|
||||
->expects($this->atLeastOnce())
|
||||
->method('getDefaultTextColorPrimary')
|
||||
->willReturn('#ffffff');
|
||||
$this->urlGenerator
|
||||
->expects($this->once())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue