mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
refactor(notifications): rename dedupKey to deduplicationKey
No abbreviations in identifier names.
This commit is contained in:
@@ -31,7 +31,7 @@ class Notification extends Event
|
||||
|
||||
protected string $template = '';
|
||||
protected array $templateParams = [];
|
||||
protected string $dedupKey = '';
|
||||
protected string $deduplicationKey = '';
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
@@ -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,
|
||||
|
||||
@@ -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'] ?? [],
|
||||
];
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user