mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Move SMTP into integrations group (external mail relay; same shape as webhook)
This commit is contained in:
1 parent
cd3fb8773f
commit
efa66d5fb7
4 files changed
+28
-27
No files matched your search
@@ -292,13 +292,13 @@ class Appwrite extends Destination
|
||||
Resource::TYPE_PLATFORM,
|
||||
Resource::TYPE_API_KEY,
|
||||
Resource::TYPE_WEBHOOK,
|
||||
Resource::TYPE_SMTP,
|
||||
|
||||
// Project
|
||||
Resource::TYPE_PROJECT_VARIABLE,
|
||||
Resource::TYPE_PROJECT_PROTOCOLS,
|
||||
Resource::TYPE_PROJECT_LABELS,
|
||||
Resource::TYPE_PROJECT_SERVICES,
|
||||
Resource::TYPE_SMTP,
|
||||
|
||||
// Backups
|
||||
Resource::TYPE_BACKUP_POLICY,
|
||||
@@ -3115,6 +3115,10 @@ class Appwrite extends Destination
|
||||
/** @var Webhook $resource */
|
||||
$this->createWebhook($resource);
|
||||
break;
|
||||
case Resource::TYPE_SMTP:
|
||||
/** @var SMTP $resource */
|
||||
$this->createSMTP($resource);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($resource->getStatus() !== Resource::STATUS_SKIPPED) {
|
||||
@@ -3143,10 +3147,6 @@ class Appwrite extends Destination
|
||||
/** @var ServicesResource $resource */
|
||||
$this->createServices($resource);
|
||||
break;
|
||||
case Resource::TYPE_SMTP:
|
||||
/** @var SMTP $resource */
|
||||
$this->createSMTP($resource);
|
||||
break;
|
||||
}
|
||||
|
||||
if ($resource->getStatus() !== Resource::STATUS_SKIPPED) {
|
||||
|
||||
@@ -79,7 +79,7 @@ class SMTP extends Resource
|
||||
|
||||
public function getGroup(): string
|
||||
{
|
||||
return Transfer::GROUP_PROJECTS;
|
||||
return Transfer::GROUP_INTEGRATIONS;
|
||||
}
|
||||
|
||||
public function getEnabled(): bool
|
||||
|
||||
@@ -227,6 +227,7 @@ class Appwrite extends Source
|
||||
Resource::TYPE_PLATFORM,
|
||||
Resource::TYPE_API_KEY,
|
||||
Resource::TYPE_WEBHOOK,
|
||||
Resource::TYPE_SMTP,
|
||||
|
||||
// Backups
|
||||
Resource::TYPE_BACKUP_POLICY,
|
||||
@@ -236,7 +237,6 @@ class Appwrite extends Source
|
||||
Resource::TYPE_PROJECT_PROTOCOLS,
|
||||
Resource::TYPE_PROJECT_LABELS,
|
||||
Resource::TYPE_PROJECT_SERVICES,
|
||||
Resource::TYPE_SMTP,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1597,11 +1597,6 @@ class Appwrite extends Source
|
||||
// Singleton — one services config per project.
|
||||
$report[Resource::TYPE_PROJECT_SERVICES] = 1;
|
||||
}
|
||||
|
||||
if (\in_array(Resource::TYPE_SMTP, $resources)) {
|
||||
// Singleton — one SMTP config per project.
|
||||
$report[Resource::TYPE_SMTP] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1666,19 +1661,6 @@ class Appwrite extends Source
|
||||
));
|
||||
}
|
||||
|
||||
try {
|
||||
if (\in_array(Resource::TYPE_SMTP, $resources)) {
|
||||
$this->exportSMTP();
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$this->addError(new Exception(
|
||||
Resource::TYPE_SMTP,
|
||||
Transfer::GROUP_PROJECTS,
|
||||
message: $e->getMessage(),
|
||||
code: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
|
||||
previous: $e
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
private function exportServices(): void
|
||||
@@ -2673,6 +2655,11 @@ class Appwrite extends Source
|
||||
$report[Resource::TYPE_WEBHOOK] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (\in_array(Resource::TYPE_SMTP, $resources)) {
|
||||
// Singleton — one SMTP config per project.
|
||||
$report[Resource::TYPE_SMTP] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2746,6 +2733,20 @@ class Appwrite extends Source
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (\in_array(Resource::TYPE_SMTP, $resources)) {
|
||||
$this->exportSMTP();
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
$this->addError(new Exception(
|
||||
Resource::TYPE_SMTP,
|
||||
Transfer::GROUP_INTEGRATIONS,
|
||||
message: $e->getMessage(),
|
||||
code: (int) $e->getCode() ?: Exception::CODE_INTERNAL,
|
||||
previous: $e
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,6 +68,7 @@ class Transfer
|
||||
Resource::TYPE_PLATFORM,
|
||||
Resource::TYPE_API_KEY,
|
||||
Resource::TYPE_WEBHOOK,
|
||||
Resource::TYPE_SMTP,
|
||||
];
|
||||
public const GROUP_DOCUMENTSDB_RESOURCES = [
|
||||
Resource::TYPE_DATABASE_DOCUMENTSDB,
|
||||
@@ -102,7 +103,6 @@ class Transfer
|
||||
Resource::TYPE_PROJECT_PROTOCOLS,
|
||||
Resource::TYPE_PROJECT_LABELS,
|
||||
Resource::TYPE_PROJECT_SERVICES,
|
||||
Resource::TYPE_SMTP,
|
||||
];
|
||||
|
||||
public const GROUP_BACKUPS_RESOURCES = [
|
||||
@@ -145,13 +145,13 @@ class Transfer
|
||||
Resource::TYPE_PLATFORM,
|
||||
Resource::TYPE_API_KEY,
|
||||
Resource::TYPE_WEBHOOK,
|
||||
Resource::TYPE_SMTP,
|
||||
|
||||
// Project
|
||||
Resource::TYPE_PROJECT_VARIABLE,
|
||||
Resource::TYPE_PROJECT_PROTOCOLS,
|
||||
Resource::TYPE_PROJECT_LABELS,
|
||||
Resource::TYPE_PROJECT_SERVICES,
|
||||
Resource::TYPE_SMTP,
|
||||
|
||||
// legacy
|
||||
Resource::TYPE_DOCUMENT,
|
||||
|
||||
Reference in new issue
Block a user