Merge branch '1.6.x' of github.com:appwrite/appwrite into chore-optimise-events-payloads

This commit is contained in:
Christy Jacob
2025-01-17 10:42:16 +05:30
120 changed files with 799 additions and 202 deletions
+11 -7
View File
@@ -41,15 +41,15 @@ class SDKs extends Action
$this
->desc('Generate Appwrite SDKs')
->param('platform', null, new Nullable(new Text(256)), 'Selected Platform', optional: true)
->param('sdk', null, new Nullable(new Text(256)), 'Selected SDK', optional:true)
->param('version', null, new Nullable(new Text(256)), 'Selected SDK', optional:true)
->param('sdk', null, new Nullable(new Text(256)), 'Selected SDK', optional: true)
->param('version', null, new Nullable(new Text(256)), 'Selected SDK', optional: true)
->param('git', null, new Nullable(new WhiteList(['yes', 'no'])), 'Should we use git push?', optional: true)
->param('production', null, new Nullable(new WhiteList(['yes', 'no'])), 'Should we push to production?', optional:true)
->param('message', null, new Nullable(new Text(256)), 'Commit Message', optional:true)
->param('production', null, new Nullable(new WhiteList(['yes', 'no'])), 'Should we push to production?', optional: true)
->param('message', null, new Nullable(new Text(256)), 'Commit Message', optional: true)
->callback([$this, 'action']);
}
public function action(?string $selectedPlatform, ?string $selectedSDK, ?string $version, ?string $git, ?string $production, ?string $message)
public function action(?string $selectedPlatform, ?string $selectedSDK, ?string $version, ?string $git, ?string $production, ?string $message): void
{
$selectedPlatform ??= Console::confirm('Choose Platform ("' . APP_PLATFORM_CLIENT . '", "' . APP_PLATFORM_SERVER . '", "' . APP_PLATFORM_CONSOLE . '" or "*" for all):');
$selectedSDK ??= \strtolower(Console::confirm('Choose SDK ("*" for all):'));
@@ -275,9 +275,13 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
\exec('rm -rf ' . $target . ' && \
mkdir -p ' . $target . ' && \
cd ' . $target . ' && \
git init --initial-branch=' . $gitBranch . ' && \
git init && \
git remote add origin ' . $gitUrl . ' && \
git fetch origin ' . $gitBranch . ' && \
git fetch origin && \
git checkout main || git checkout -b main && \
git pull origin main && \
git checkout ' . $gitBranch . ' || git checkout -b ' . $gitBranch . ' && \
git fetch origin ' . $gitBranch . ' || git push -u origin ' . $gitBranch . ' && \
git pull origin ' . $gitBranch . ' && \
rm -rf ' . $target . '/* && \
cp -r ' . $result . '/. ' . $target . '/ && \
+24 -6
View File
@@ -32,6 +32,7 @@ use Utopia\Messaging\Messages\Email;
use Utopia\Messaging\Messages\Email\Attachment;
use Utopia\Messaging\Messages\Push;
use Utopia\Messaging\Messages\SMS;
use Utopia\Messaging\Priority;
use Utopia\Platform\Action;
use Utopia\Queue\Message;
use Utopia\Storage\Device;
@@ -277,7 +278,7 @@ class Messaging extends Action
Query::equal('identifier', [$result['recipient']])
]);
if ($target instanceof Document && !$target->isEmpty()) {
if (!$target->isEmpty()) {
$dbForProject->updateDocument(
'targets',
$target->getId(),
@@ -289,7 +290,7 @@ class Messaging extends Action
} catch (\Throwable $e) {
$deliveryErrors[] = 'Failed sending to targets with error: ' . $e->getMessage();
} finally {
$errorTotal = count($deliveryErrors);
$errorTotal = \count($deliveryErrors);
$queueForUsage
->setProject($project)
->addMetric(METRIC_MESSAGES, ($deliveredTotal + $errorTotal))
@@ -335,7 +336,6 @@ class Messaging extends Action
$message->setAttribute('status', MessageStatus::SENT);
}
$message->removeAttribute('to');
foreach ($providers as $provider) {
@@ -668,8 +668,8 @@ class Messaging extends Action
private function buildPushMessage(Document $message): Push
{
$to = $message['to'];
$title = $message['data']['title'];
$body = $message['data']['body'];
$title = $message['data']['title'] ?? null;
$body = $message['data']['body'] ?? null;
$data = $message['data']['data'] ?? null;
$action = $message['data']['action'] ?? null;
$image = $message['data']['image']['url'] ?? null;
@@ -678,6 +678,21 @@ class Messaging extends Action
$color = $message['data']['color'] ?? null;
$tag = $message['data']['tag'] ?? null;
$badge = $message['data']['badge'] ?? null;
$contentAvailable = $message['data']['contentAvailable'] ?? null;
$critical = $message['data']['critical'] ?? null;
$priority = $message['data']['priority'] ?? null;
if ($title === '') {
$title = null;
}
if ($body === '') {
$body = null;
}
if ($priority !== null) {
$priority = $priority === 'high'
? Priority::HIGH
: Priority::NORMAL;
}
return new Push(
$to,
@@ -690,7 +705,10 @@ class Messaging extends Action
$icon,
$color,
$tag,
$badge
$badge,
$contentAvailable,
$critical,
$priority
);
}
+2
View File
@@ -215,6 +215,8 @@ abstract class Format
switch ($param) {
case 'status':
return 'MessageStatus';
case 'priority':
return 'MessagePriority';
}
break;
case 'createSmtpProvider':
@@ -34,7 +34,6 @@ class Swagger2 extends Format
foreach ($this->models as $m) {
if ($m->getType() === $ruleType) {
$this->getNestedModels($m, $usedModels);
continue;
}
}
}
@@ -46,7 +45,6 @@ class Swagger2 extends Format
foreach ($this->models as $m) {
if ($m->getType() === $rule['type']) {
$this->getNestedModels($m, $usedModels);
continue;
}
}
}