From 5320c9441b5ca417fe5334aad78b7e549e44bed7 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Fri, 1 May 2026 13:58:13 +1200 Subject: [PATCH] refactor(notifications): rename dedupKey to deduplicationKey No abbreviations in identifier names. --- src/Appwrite/Event/Notification.php | 14 +++++++------- src/Appwrite/Platform/Workers/Notifications.php | 10 +++++----- tests/unit/Platform/Workers/NotificationsTest.php | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Appwrite/Event/Notification.php b/src/Appwrite/Event/Notification.php index fa490f3405..f4956ffa9b 100644 --- a/src/Appwrite/Event/Notification.php +++ b/src/Appwrite/Event/Notification.php @@ -31,7 +31,7 @@ class Notification extends Event protected string $template = ''; protected array $templateParams = []; - protected string $dedupKey = ''; + protected string $deduplicationKey = ''; /** * @var array @@ -357,15 +357,15 @@ class Notification extends Event return $this->templateParams; } - public function setDedupKey(string $dedupKey): self + public function setDeduplicationKey(string $deduplicationKey): self { - $this->dedupKey = $dedupKey; + $this->deduplicationKey = $deduplicationKey; return $this; } - public function getDedupKey(): string + public function getDeduplicationKey(): string { - return $this->dedupKey; + return $this->deduplicationKey; } /** @@ -400,7 +400,7 @@ class Notification extends Event $this->channels = []; $this->template = ''; $this->templateParams = []; - $this->dedupKey = ''; + $this->deduplicationKey = ''; $this->permissions = []; return $this; } @@ -427,7 +427,7 @@ class Notification extends Event 'channels' => $this->channels, 'template' => $this->template, 'templateParams' => $this->templateParams, - 'dedupKey' => $this->dedupKey, + 'deduplicationKey' => $this->deduplicationKey, 'permissions' => $this->permissions, 'name' => $this->name, 'subject' => $this->subject, diff --git a/src/Appwrite/Platform/Workers/Notifications.php b/src/Appwrite/Platform/Workers/Notifications.php index 5e86a8b021..15cde66a3a 100644 --- a/src/Appwrite/Platform/Workers/Notifications.php +++ b/src/Appwrite/Platform/Workers/Notifications.php @@ -64,8 +64,8 @@ class Notifications extends Action throw new Exception('Missing payload'); } - $dedupKey = $payload['dedupKey'] ?? ''; - $messageId = $dedupKey !== '' ? \md5($dedupKey) : ''; + $deduplicationKey = $payload['deduplicationKey'] ?? ''; + $messageId = $deduplicationKey !== '' ? \md5($deduplicationKey) : ''; if ($messageId !== '' && $this->alreadyDelivered($dbForProject, $messageId)) { $log->addTag('dedup', 'hit'); @@ -299,8 +299,8 @@ class Notifications extends Action $recipients = [['userId' => $address]]; - $dedupKey = $payload['dedupKey'] ?? ''; - $messageId = $dedupKey !== '' ? \md5($dedupKey) : null; + $deduplicationKey = $payload['deduplicationKey'] ?? ''; + $messageId = $deduplicationKey !== '' ? \md5($deduplicationKey) : null; $consoleMessage = new ConsoleMessage( recipients: $recipients, @@ -323,7 +323,7 @@ class Notifications extends Action 'template' => $payload['template'] ?? '', 'params' => $payload['templateParams'] ?? [], 'project' => \is_array($payload['project'] ?? null) ? ($payload['project']['$id'] ?? null) : null, - 'dedupKey' => $payload['dedupKey'] ?? '', + 'deduplicationKey' => $payload['deduplicationKey'] ?? '', 'events' => $payload['events'] ?? [], ]; diff --git a/tests/unit/Platform/Workers/NotificationsTest.php b/tests/unit/Platform/Workers/NotificationsTest.php index c7889851a8..8876dd1dea 100644 --- a/tests/unit/Platform/Workers/NotificationsTest.php +++ b/tests/unit/Platform/Workers/NotificationsTest.php @@ -115,7 +115,7 @@ class NotificationsTest extends TestCase ], 'subject' => 'Hi', 'body' => 'Body', - 'dedupKey' => 'event-1', + 'deduplicationKey' => 'event-1', ]; $worker->action($this->buildMessage($payload), $this->project, $this->registry, $this->database, $this->log); @@ -136,7 +136,7 @@ class NotificationsTest extends TestCase ], 'subject' => 'Heads up', 'body' => 'Read me', - 'dedupKey' => 'evt-multi', + 'deduplicationKey' => 'evt-multi', 'permissions' => [Permission::read(Role::any())], ]; @@ -164,7 +164,7 @@ class NotificationsTest extends TestCase 'recipients' => [['address' => 'user-1', 'channel' => NOTIFICATION_CHANNEL_CONSOLE]], 'subject' => 'Sub', 'body' => 'B', - 'dedupKey' => 'dup-key', + 'deduplicationKey' => 'dup-key', ]; // First run delivers and persists. @@ -229,7 +229,7 @@ class NotificationsTest extends TestCase 'recipients' => [['address' => 'https://h.example.test', 'channel' => NOTIFICATION_CHANNEL_WEBHOOK]], 'subject' => 's', 'body' => 'b', - 'dedupKey' => 'err-1', + 'deduplicationKey' => 'err-1', ]; try {