Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve feedback in test-push when device is too old #1101

Merged
Merged
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
7 changes: 6 additions & 1 deletion lib/Push.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('<error>User status is set to DND - no push notifications will be sent</error>');
return;
}
}
Expand Down Expand Up @@ -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
Expand Down