From 80dd70d853ff8a3c19891afc48e5d041ccb12d84 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 27 Oct 2021 09:44:11 +0200 Subject: [PATCH] Improve feedback in test-push when device is too old Signed-off-by: Joas Schilling --- lib/Push.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Push.php b/lib/Push.php index 1405297c7..8df6c0405 100644 --- a/lib/Push.php +++ b/lib/Push.php @@ -170,7 +170,7 @@ public function pushToDevice(int $id, INotification $notification, ?OutputInterf if (isset($userStatus[$notification->getUser()])) { $userStatus = $userStatus[$notification->getUser()]; if ($userStatus->getStatus() === IUserStatus::DND) { - $this->printInfo('User status is set to DND'); + $this->printInfo('User status is set to DND - no push notifications will be sent'); return; } } @@ -390,6 +390,11 @@ protected function validateToken(int $tokenId, int $maxAge): bool { // Check if the token is still valid... $token = $this->tokenProvider->getTokenById($tokenId); $this->cache->set('t' . $tokenId, $token->getLastCheck(), 600); + if ($token->getLastCheck() > $maxAge) { + $this->printInfo('Device token is valid'); + } else { + $this->printInfo('Device token "last checked" is older than 60 days: ' . $token->getLastCheck()); + } return $token->getLastCheck() > $maxAge; } catch (InvalidTokenException $e) { // Token does not exist anymore, should drop the push device entry