From 70ad2731a3fb145e461bd03d1aa470681f089973 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Fri, 26 Jan 2024 10:51:40 +0000 Subject: [PATCH] More bug fixes --- app/controllers/api/account.php | 6 +++--- src/Appwrite/Platform/Workers/Certificates.php | 3 +-- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 48c29b343a..96fd618abf 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -1404,9 +1404,9 @@ App::post('/v1/account/tokens/email') 'team' => '', 'project' => $project->getAttribute('name'), 'otp' => $tokenSecret, - 'agentDevice' => '' . ( $agentDevice['deviceBrand'] ?? $agentDevice['deviceBrand'] ?? 'Unknown device') . '', - 'agentClient' => '' . ($agentClient['clientName'] ?? 'Unknown client') . '', - 'agentOs' => '' . ($agentOs['osName'] ?? 'Unknown OS') . '', + 'agentDevice' => '' . (!empty($agentDevice['deviceBrand']) ? $agentDevice['deviceBrand'] : 'Unknown device') . '', + 'agentClient' => '' . (!empty($agentOs['clientName']) ? $agentOs['clientName'] : 'Unknown client') . '', + 'agentOs' => '' . (!empty($agentOs['osName']) ? $agentOs['osName'] : 'Unknown OS') . '', 'phrase' => '' . (!empty($securityPhrase) ? $securityPhrase : '') . '' ]; diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 4d3cb8f593..a57c6703d0 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -429,7 +429,7 @@ class Certificates extends Action // Send mail to administratore mail $template = Template::fromFile(__DIR__ . '/../../../../app/config/locale/templates/email-certificate-failed.tpl'); $template->setParam('{{domain}}', $domain); - $template->setParam('{{error}}', \nl2br($errorMessage)); + $template->setParam('{{error}}', \nl2br($errorMessage), false); $template->setParam('{{attempts}}', $attempt); $subject = 'Certificate for ' . $domain . ' failed to generate'; @@ -437,7 +437,6 @@ class Certificates extends Action $emailVariables = [ 'direction' => $locale->getText('settings.direction'), 'domain' => $domain, - 'error' => '
' . $errorMessage . '
', 'attempt' => $attempt, 'project' => 'Console', 'redirect' => 'https://' . $domain, diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index c89adad1d2..9ed2bf0b60 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -604,6 +604,8 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(204, $response['headers']['status-code']); + \sleep(5); + $emails = $this->getLastEmail(2); $this->assertCount(2, $emails); $this->assertEquals('custommailer@appwrite.io', $emails[0]['from'][0]['address']);