From 6684364b981beb78b765d18e133d304c35d3dbcb Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Thu, 8 May 2025 07:25:29 +0000 Subject: [PATCH 01/37] chore: improve route not found error message --- app/config/errors.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/config/errors.php b/app/config/errors.php index 4b2e58b08b..eb5a6cbbbb 100644 --- a/app/config/errors.php +++ b/app/config/errors.php @@ -81,7 +81,7 @@ return [ ], Exception::GENERAL_ROUTE_NOT_FOUND => [ 'name' => Exception::GENERAL_ROUTE_NOT_FOUND, - 'description' => 'The requested route was not found. Please refer to the API docs and try again.', + 'description' => 'Route not found. Please ensure the endpoint is configured correctly and that the API route is valid for this SDK version. Refer to the API docs for more details.', 'code' => 404, ], Exception::GENERAL_CURSOR_NOT_FOUND => [ From b0e95171f803c5444c4255670dda6a73d213c9f1 Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Sat, 10 May 2025 14:29:11 +0000 Subject: [PATCH 02/37] chore: update react native and generate sdk --- app/config/platforms.php | 2 +- app/config/specs/open-api3-1.6.x-client.json | 20 ---------- app/config/specs/open-api3-1.6.x-console.json | 20 ---------- app/config/specs/open-api3-1.6.x-server.json | 20 ---------- app/config/specs/open-api3-latest-client.json | 20 ---------- .../specs/open-api3-latest-console.json | 20 ---------- app/config/specs/open-api3-latest-server.json | 20 ---------- app/config/specs/swagger2-1.6.x-client.json | 20 ---------- app/config/specs/swagger2-1.6.x-console.json | 20 ---------- app/config/specs/swagger2-1.6.x-server.json | 20 ---------- app/config/specs/swagger2-latest-client.json | 20 ---------- app/config/specs/swagger2-latest-console.json | 20 ---------- app/config/specs/swagger2-latest-server.json | 20 ---------- app/controllers/api/databases.php | 38 +++++++++---------- composer.lock | 12 +++--- docs/sdks/react-native/CHANGELOG.md | 7 +++- 16 files changed, 32 insertions(+), 267 deletions(-) diff --git a/app/config/platforms.php b/app/config/platforms.php index 98afd1a9b4..aff6aaf7c0 100644 --- a/app/config/platforms.php +++ b/app/config/platforms.php @@ -134,7 +134,7 @@ return [ [ 'key' => 'react-native', 'name' => 'React Native', - 'version' => '0.7.3', + 'version' => '0.7.4', 'url' => 'https://github.com/appwrite/sdk-for-react-native', 'package' => 'https://npmjs.com/package/react-native-appwrite', 'enabled' => true, diff --git a/app/config/specs/open-api3-1.6.x-client.json b/app/config/specs/open-api3-1.6.x-client.json index 3cb424e53b..e84c511f78 100644 --- a/app/config/specs/open-api3-1.6.x-client.json +++ b/app/config/specs/open-api3-1.6.x-client.json @@ -4485,26 +4485,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/components\/schemas\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/open-api3-1.6.x-console.json b/app/config/specs/open-api3-1.6.x-console.json index ede32a8dbc..16ac0ee040 100644 --- a/app/config/specs/open-api3-1.6.x-console.json +++ b/app/config/specs/open-api3-1.6.x-console.json @@ -7976,26 +7976,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/components\/schemas\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/open-api3-1.6.x-server.json b/app/config/specs/open-api3-1.6.x-server.json index 584caa2956..e3d2255c8d 100644 --- a/app/config/specs/open-api3-1.6.x-server.json +++ b/app/config/specs/open-api3-1.6.x-server.json @@ -7525,26 +7525,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/components\/schemas\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/open-api3-latest-client.json b/app/config/specs/open-api3-latest-client.json index 3cb424e53b..e84c511f78 100644 --- a/app/config/specs/open-api3-latest-client.json +++ b/app/config/specs/open-api3-latest-client.json @@ -4485,26 +4485,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/components\/schemas\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/open-api3-latest-console.json b/app/config/specs/open-api3-latest-console.json index ede32a8dbc..16ac0ee040 100644 --- a/app/config/specs/open-api3-latest-console.json +++ b/app/config/specs/open-api3-latest-console.json @@ -7976,26 +7976,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/components\/schemas\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/open-api3-latest-server.json b/app/config/specs/open-api3-latest-server.json index 584caa2956..e3d2255c8d 100644 --- a/app/config/specs/open-api3-latest-server.json +++ b/app/config/specs/open-api3-latest-server.json @@ -7525,26 +7525,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/components\/schemas\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/swagger2-1.6.x-client.json b/app/config/specs/swagger2-1.6.x-client.json index e3b2663cab..6033eb40ea 100644 --- a/app/config/specs/swagger2-1.6.x-client.json +++ b/app/config/specs/swagger2-1.6.x-client.json @@ -4625,26 +4625,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/definitions\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/swagger2-1.6.x-console.json b/app/config/specs/swagger2-1.6.x-console.json index 808ce06f85..5b61ba75d6 100644 --- a/app/config/specs/swagger2-1.6.x-console.json +++ b/app/config/specs/swagger2-1.6.x-console.json @@ -8107,26 +8107,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/definitions\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/swagger2-1.6.x-server.json b/app/config/specs/swagger2-1.6.x-server.json index f3da5cf4f8..697f28c1e4 100644 --- a/app/config/specs/swagger2-1.6.x-server.json +++ b/app/config/specs/swagger2-1.6.x-server.json @@ -7644,26 +7644,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/definitions\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/swagger2-latest-client.json b/app/config/specs/swagger2-latest-client.json index e3b2663cab..6033eb40ea 100644 --- a/app/config/specs/swagger2-latest-client.json +++ b/app/config/specs/swagger2-latest-client.json @@ -4625,26 +4625,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/definitions\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/swagger2-latest-console.json b/app/config/specs/swagger2-latest-console.json index 808ce06f85..5b61ba75d6 100644 --- a/app/config/specs/swagger2-latest-console.json +++ b/app/config/specs/swagger2-latest-console.json @@ -8107,26 +8107,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/definitions\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/config/specs/swagger2-latest-server.json b/app/config/specs/swagger2-latest-server.json index f3da5cf4f8..697f28c1e4 100644 --- a/app/config/specs/swagger2-latest-server.json +++ b/app/config/specs/swagger2-latest-server.json @@ -7644,26 +7644,6 @@ } ], "description": "Create a new Document. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console." - }, - { - "name": "createDocuments", - "parameters": [ - "databaseId", - "collectionId", - "documents" - ], - "required": [ - "databaseId", - "collectionId", - "documents" - ], - "responses": [ - { - "code": 201, - "model": "#\/definitions\/documentList" - } - ], - "description": "Create new Documents. Before using this route, you should create a new collection resource using either a [server integration](https:\/\/appwrite.io\/docs\/server\/databases#databasesCreateCollection) API or directly from your database console.\n" } ], "auth": { diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 0bdb42ec1c..edc9d55ddb 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -3204,25 +3204,25 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/documents') new Parameter('permissions', optional: true), ] ), - new Method( - namespace: 'databases', - group: 'documents', - name: 'createDocuments', - description: '/docs/references/databases/create-documents.md', - auth: [AuthType::KEY], - responses: [ - new SDKResponse( - code: Response::STATUS_CODE_CREATED, - model: Response::MODEL_DOCUMENT_LIST, - ) - ], - contentType: ContentType::JSON, - parameters: [ - new Parameter('databaseId', optional: false), - new Parameter('collectionId', optional: false), - new Parameter('documents', optional: false), - ] - ) + // new Method( + // namespace: 'databases', + // group: 'documents', + // name: 'createDocuments', + // description: '/docs/references/databases/create-documents.md', + // auth: [AuthType::KEY], + // responses: [ + // new SDKResponse( + // code: Response::STATUS_CODE_CREATED, + // model: Response::MODEL_DOCUMENT_LIST, + // ) + // ], + // contentType: ContentType::JSON, + // parameters: [ + // new Parameter('databaseId', optional: false), + // new Parameter('collectionId', optional: false), + // new Parameter('documents', optional: false), + // ] + // ) ] ) ->param('databaseId', '', new UID(), 'Database ID.') diff --git a/composer.lock b/composer.lock index b56b7b387d..cf15b7657e 100644 --- a/composer.lock +++ b/composer.lock @@ -4769,16 +4769,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.40.15", + "version": "0.40.16", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "65c708b931b29b3e01c5cc7504a734ce2cc3dc95" + "reference": "f1f506da74033f0cb5a11e3dffcfd1ee8daf237d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/65c708b931b29b3e01c5cc7504a734ce2cc3dc95", - "reference": "65c708b931b29b3e01c5cc7504a734ce2cc3dc95", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/f1f506da74033f0cb5a11e3dffcfd1ee8daf237d", + "reference": "f1f506da74033f0cb5a11e3dffcfd1ee8daf237d", "shasum": "" }, "require": { @@ -4814,9 +4814,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.40.15" + "source": "https://github.com/appwrite/sdk-generator/tree/0.40.16" }, - "time": "2025-04-25T08:50:44+00:00" + "time": "2025-05-09T12:06:09+00:00" }, { "name": "doctrine/annotations", diff --git a/docs/sdks/react-native/CHANGELOG.md b/docs/sdks/react-native/CHANGELOG.md index 21fbe5456c..f720e11ac6 100644 --- a/docs/sdks/react-native/CHANGELOG.md +++ b/docs/sdks/react-native/CHANGELOG.md @@ -1 +1,6 @@ -# Change log \ No newline at end of file +# Change log + +## 0.7.4 + +* Upgrade dependencies to resolve PlatformConstants error with Expo 53 +* Update doc examples to use new multi-region endpoint \ No newline at end of file From a802a78b0b40acd333214dafd27d32d06c18979f Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 12 May 2025 13:10:58 +0000 Subject: [PATCH 03/37] feat: plan based email logoUrl --- .../locale/templates/email-base-styled.tpl | 2 +- app/controllers/api/projects.php | 6 ++++-- app/init/constants.php | 1 + src/Appwrite/Platform/Workers/Certificates.php | 16 +++++++++++----- src/Appwrite/Platform/Workers/Webhooks.php | 16 +++++++++++----- 5 files changed, 28 insertions(+), 13 deletions(-) diff --git a/app/config/locale/templates/email-base-styled.tpl b/app/config/locale/templates/email-base-styled.tpl index 4d6972389e..7add785b11 100644 --- a/app/config/locale/templates/email-base-styled.tpl +++ b/app/config/locale/templates/email-base-styled.tpl @@ -126,7 +126,7 @@ diff --git a/app/controllers/api/projects.php b/app/controllers/api/projects.php index 839a51a764..a626c677c2 100644 --- a/app/controllers/api/projects.php +++ b/app/controllers/api/projects.php @@ -2139,7 +2139,8 @@ App::post('/v1/projects/:projectId/smtp/tests') ->inject('response') ->inject('dbForPlatform') ->inject('queueForMails') - ->action(function (string $projectId, array $emails, string $senderName, string $senderEmail, string $replyTo, string $host, int $port, string $username, string $password, string $secure, Response $response, Database $dbForPlatform, Mail $queueForMails) { + ->inject('plan') + ->action(function (string $projectId, array $emails, string $senderName, string $senderEmail, string $replyTo, string $host, int $port, string $username, string $password, string $secure, Response $response, Database $dbForPlatform, Mail $queueForMails, array $plan) { $project = $dbForPlatform->getDocument('projects', $projectId); if ($project->isEmpty()) { @@ -2152,7 +2153,8 @@ App::post('/v1/projects/:projectId/smtp/tests') $template = Template::fromFile(__DIR__ . '/../../config/locale/templates/email-smtp-test.tpl'); $template ->setParam('{{from}}', "{$senderName} ({$senderEmail})") - ->setParam('{{replyTo}}', "{$senderName} ({$replyToEmail})"); + ->setParam('{{replyTo}}', "{$senderName} ({$replyToEmail})") + ->setParam('{{logoUrl}}', $plan['logoUrl'] ?? APP_EMAIL_LOGO_URL); foreach ($emails as $email) { $queueForMails diff --git a/app/init/constants.php b/app/init/constants.php index 143bba29bd..6658048f07 100644 --- a/app/init/constants.php +++ b/app/init/constants.php @@ -6,6 +6,7 @@ const APP_NAME = 'Appwrite'; const APP_DOMAIN = 'appwrite.io'; const APP_EMAIL_TEAM = 'team@localhost.test'; // Default email address const APP_EMAIL_SECURITY = ''; // Default security email address +const APP_EMAIL_LOGO_URL = 'https://cloud.appwrite.io/images/mails/logo.png'; const APP_USERAGENT = APP_NAME . '-Server v%s. Please report abuse at %s'; const APP_MODE_DEFAULT = 'default'; const APP_MODE_ADMIN = 'admin'; diff --git a/src/Appwrite/Platform/Workers/Certificates.php b/src/Appwrite/Platform/Workers/Certificates.php index 15f9645bb0..ce7b5f3522 100644 --- a/src/Appwrite/Platform/Workers/Certificates.php +++ b/src/Appwrite/Platform/Workers/Certificates.php @@ -54,6 +54,7 @@ class Certificates extends Action ->inject('queueForRealtime') ->inject('log') ->inject('certificates') + ->inject('plan') ->callback([$this, 'action']); } @@ -80,7 +81,8 @@ class Certificates extends Action Func $queueForFunctions, Realtime $queueForRealtime, Log $log, - CertificatesAdapter $certificates + CertificatesAdapter $certificates, + array $plan ): void { $payload = $message->getPayload() ?? []; @@ -94,7 +96,7 @@ class Certificates extends Action $log->addTag('domain', $domain->get()); - $this->execute($domain, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates, $skipRenewCheck); + $this->execute($domain, $dbForPlatform, $queueForMails, $queueForEvents, $queueForWebhooks, $queueForFunctions, $queueForRealtime, $log, $certificates, $skipRenewCheck, $plan); } /** @@ -106,6 +108,7 @@ class Certificates extends Action * @param Realtime $queueForRealtime * @param CertificatesAdapter $certificates * @param bool $skipRenewCheck + * @param array $plan * @return void * @throws Throwable * @throws \Utopia\Database\Exception @@ -120,7 +123,8 @@ class Certificates extends Action Realtime $queueForRealtime, Log $log, CertificatesAdapter $certificates, - bool $skipRenewCheck = false + bool $skipRenewCheck = false, + array $plan = [] ): void { /** * 1. Read arguments and validate domain @@ -202,7 +206,7 @@ class Certificates extends Action $certificate->setAttribute('renewDate', DateTime::now()); // Send email to security email - $this->notifyError($domain->get(), $e->getMessage(), $attempts, $queueForMails); + $this->notifyError($domain->get(), $e->getMessage(), $attempts, $queueForMails, $plan); throw $e; } finally { @@ -342,10 +346,11 @@ class Certificates extends Action * @param string $errorMessage Verbose error message * @param int $attempt How many times it failed already * @param Mail $queueForMails + * @param array $plan * @return void * @throws Exception */ - private function notifyError(string $domain, string $errorMessage, int $attempt, Mail $queueForMails): void + private function notifyError(string $domain, string $errorMessage, int $attempt, Mail $queueForMails, array $plan): void { // Log error into console Console::warning('Cannot renew domain (' . $domain . ') on attempt no. ' . $attempt . ' certificate: ' . $errorMessage); @@ -357,6 +362,7 @@ class Certificates extends Action $template->setParam('{{domain}}', $domain); $template->setParam('{{error}}', \nl2br($errorMessage)); $template->setParam('{{attempts}}', $attempt); + $template->setParam('{{logoUrl}}', $plan['logoUrl'] ?? APP_EMAIL_LOGO_URL); $body = $template->render(); $emailVariables = [ diff --git a/src/Appwrite/Platform/Workers/Webhooks.php b/src/Appwrite/Platform/Workers/Webhooks.php index b36f4cb67c..82a26f849c 100644 --- a/src/Appwrite/Platform/Workers/Webhooks.php +++ b/src/Appwrite/Platform/Workers/Webhooks.php @@ -37,6 +37,7 @@ class Webhooks extends Action ->inject('queueForMails') ->inject('queueForStatsUsage') ->inject('log') + ->inject('plan') ->callback([$this, 'action']); } @@ -45,11 +46,13 @@ class Webhooks extends Action * @param Document $project * @param Database $dbForPlatform * @param Mail $queueForMails + * @param StatsUsage $queueForStatsUsage * @param Log $log + * @param array $plan * @return void * @throws Exception */ - public function action(Message $message, Document $project, Database $dbForPlatform, Mail $queueForMails, StatsUsage $queueForStatsUsage, Log $log): void + public function action(Message $message, Document $project, Database $dbForPlatform, Mail $queueForMails, StatsUsage $queueForStatsUsage, Log $log, array $plan): void { $this->errors = []; $payload = $message->getPayload() ?? []; @@ -68,7 +71,7 @@ class Webhooks extends Action foreach ($project->getAttribute('webhooks', []) as $webhook) { if (array_intersect($webhook->getAttribute('events', []), $events)) { - $this->execute($events, $webhookPayload, $webhook, $user, $project, $dbForPlatform, $queueForMails, $queueForStatsUsage); + $this->execute($events, $webhookPayload, $webhook, $user, $project, $dbForPlatform, $queueForMails, $queueForStatsUsage, $plan); } } @@ -85,9 +88,10 @@ class Webhooks extends Action * @param Document $project * @param Database $dbForPlatform * @param Mail $queueForMails + * @param array $plan * @return void */ - private function execute(array $events, string $payload, Document $webhook, Document $user, Document $project, Database $dbForPlatform, Mail $queueForMails, StatsUsage $queueForStatsUsage): void + private function execute(array $events, string $payload, Document $webhook, Document $user, Document $project, Database $dbForPlatform, Mail $queueForMails, StatsUsage $queueForStatsUsage, array $plan): void { if ($webhook->getAttribute('enabled') !== true) { return; @@ -163,7 +167,7 @@ class Webhooks extends Action if ($attempts >= \intval(System::getEnv('_APP_WEBHOOK_MAX_FAILED_ATTEMPTS', '10'))) { $webhook->setAttribute('enabled', false); - $this->sendEmailAlert($attempts, $statusCode, $webhook, $project, $dbForPlatform, $queueForMails); + $this->sendEmailAlert($attempts, $statusCode, $webhook, $project, $dbForPlatform, $queueForMails, $plan); } $dbForPlatform->updateDocument('webhooks', $webhook->getId(), $webhook); @@ -198,9 +202,10 @@ class Webhooks extends Action * @param Document $project * @param Database $dbForPlatform * @param Mail $queueForMails + * @param array $plan * @return void */ - public function sendEmailAlert(int $attempts, mixed $statusCode, Document $webhook, Document $project, Database $dbForPlatform, Mail $queueForMails): void + public function sendEmailAlert(int $attempts, mixed $statusCode, Document $webhook, Document $project, Database $dbForPlatform, Mail $queueForMails, array $plan): void { $memberships = $dbForPlatform->find('memberships', [ Query::equal('teamInternalId', [$project->getAttribute('teamInternalId')]), @@ -224,6 +229,7 @@ class Webhooks extends Action $template->setParam('{{error}}', $curlError ?? 'The server returned ' . $statusCode . ' status code'); $template->setParam('{{path}}', "/console/project-$projectId/settings/webhooks/$webhookId"); $template->setParam('{{attempts}}', $attempts); + $template->setParam('{{logoUrl}}', $plan['logoUrl'] ?? APP_EMAIL_LOGO_URL); // TODO: Use setbodyTemplate once #7307 is merged $subject = 'Webhook deliveries have been paused'; From 980afc2eaf574c0c5ded696064c9c945b6fb0f0f Mon Sep 17 00:00:00 2001 From: Chirag Aggarwal Date: Mon, 12 May 2025 13:20:59 +0000 Subject: [PATCH 04/37] chore: update social links --- app/config/locale/templates/email-base-styled.tpl | 10 +++++----- app/controllers/api/projects.php | 7 ++++++- app/init/constants.php | 3 +++ src/Appwrite/Platform/Workers/Certificates.php | 7 +++++++ src/Appwrite/Platform/Workers/Webhooks.php | 6 ++++++ 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/app/config/locale/templates/email-base-styled.tpl b/app/config/locale/templates/email-base-styled.tpl index 7add785b11..860e964672 100644 --- a/app/config/locale/templates/email-base-styled.tpl +++ b/app/config/locale/templates/email-base-styled.tpl @@ -164,7 +164,7 @@