diff options
author | Marcel Müller <marcel-mueller@gmx.de> | 2023-05-29 13:31:09 +0200 |
---|---|---|
committer | Marcel Müller <marcel-mueller@gmx.de> | 2023-07-10 08:21:50 +0200 |
commit | 21f6cef9b132db2666165186226f19cfc5baaf3d (patch) | |
tree | 721f3316249b64aa5c993db11adea0997fdde420 /lib/Notification/Notifier.php | |
parent | ef1d0080fa152f848dfc37be1f5dd296825d5cf6 (diff) |
Add background job to check TURN certificate
Signed-off-by: Marcel Müller <marcel-mueller@gmx.de>
Diffstat (limited to 'lib/Notification/Notifier.php')
-rw-r--r-- | lib/Notification/Notifier.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 0b0f62e12..e22413990 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -239,6 +239,10 @@ class Notifier implements INotifier { return $this->parseRemoteInvitationMessage($notification, $l); } + if ($notification->getObjectType() === 'turn_certificate_expiration') { + return $this->parseTurnCertificateExpiration($notification, $l); + } + try { $room = $this->getRoom($notification->getObjectId(), $userId); } catch (RoomNotFoundException $e) { @@ -1030,4 +1034,27 @@ class Notifier implements INotifier { ->setIcon($notification->getIcon()) ->addParsedAction($action); } + + protected function parseTurnCertificateExpiration(INotification $notification, IL10N $l): INotification { + $subjectParameters = $notification->getSubjectParameters(); + + $host = $subjectParameters['host']; + $daysToExpire = $subjectParameters['days_to_expire']; + + if ($daysToExpire > 0) { + $subject = $l->t('The certificate of {host} expires in {days} days'); + } else { + $subject = $l->t('The certificate of {host} expired'); + } + + $subject = str_replace( + ['{host}', '{days}'], + [$host, $daysToExpire], + $subject + ); + + $notification->setParsedSubject($subject); + + return $notification; + } } |