Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/Push.php
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,8 @@ protected function sendNotificationsToProxies(): void {
if (is_array($bodyData['unknown'])) {
// Proxy returns null when the array is empty
foreach ($bodyData['unknown'] as $unknownDevice) {
$this->printInfo('<comment>Deleting device because it is unknown by the push server: ' . $unknownDevice . '</comment>');
$this->deleteProxyPushTokenByDeviceIdentifier($unknownDevice);
$this->printInfo('<comment>Deleting device because it is unknown by the push server [' . $proxyServer . ']: ' . $unknownDevice . '</comment>');
$this->deleteProxyPushTokenByDeviceIdentifier($proxyServer, $unknownDevice);
}
}

Expand Down Expand Up @@ -1121,10 +1121,11 @@ protected function deleteProxyPushToken(int $tokenId): bool {
* @param string $deviceIdentifier
* @return bool
*/
protected function deleteProxyPushTokenByDeviceIdentifier(string $deviceIdentifier): bool {
protected function deleteProxyPushTokenByDeviceIdentifier(string $proxyServer, string $deviceIdentifier): bool {
$query = $this->db->getQueryBuilder();
$query->delete('notifications_pushhash')
->where($query->expr()->eq('deviceidentifier', $query->createNamedParameter($deviceIdentifier)));
->where($query->expr()->eq('proxyserver', $query->createNamedParameter($proxyServer)))
->andWhere($query->expr()->eq('deviceidentifier', $query->createNamedParameter($deviceIdentifier)));

return $query->executeStatement() !== 0;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Unit/PushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public function testProxyPushToDeviceNoFairUse(): void {
->willReturn(false);

$push->method('deleteProxyPushTokenByDeviceIdentifier')
->with('123456');
->with('proxyserver', '123456');

$push->pushToDevice(207787, $notification);
}
Expand Down Expand Up @@ -659,7 +659,7 @@ public function testPushToDeviceSending(bool $isDebug): void {
->willReturn(true);

$push->method('deleteProxyPushTokenByDeviceIdentifier')
->with('123456');
->with('badrequest-with-devices', '123456');

$push->pushToDevice(207787, $notification);
}
Expand Down