diff --git a/lib/Activity/Provider/Base.php b/lib/Activity/Provider/Base.php index 9597a6169fa..667f010a06f 100644 --- a/lib/Activity/Provider/Base.php +++ b/lib/Activity/Provider/Base.php @@ -116,12 +116,11 @@ protected function getRoom(Room $room, string $userId): array { ]; } - protected function getFormerRoom(IL10N $l, int $roomId): array { + protected function getFormerRoom(IL10N $l): array { return [ - 'type' => 'call', - 'id' => $roomId, + 'type' => 'highlight', + 'id' => 'deleted', 'name' => $l->t('a conversation'), - 'call-type' => Room::TYPE_UNKNOWN, ]; } diff --git a/lib/Activity/Provider/Invitation.php b/lib/Activity/Provider/Invitation.php index bf870c73415..3c70b4a311c 100644 --- a/lib/Activity/Provider/Invitation.php +++ b/lib/Activity/Provider/Invitation.php @@ -42,11 +42,11 @@ public function parse($language, IEvent $event, IEvent $previousEvent = null): I $l = $this->languageFactory->get('spreed', $language); $parameters = $event->getSubjectParameters(); - $roomParameter = $this->getFormerRoom($l, (int) $parameters['room']); try { $room = $this->manager->getRoomById((int) $parameters['room']); $roomParameter = $this->getRoom($room, $event->getAffectedUser()); - } catch (RoomNotFoundException $e) { + } catch (RoomNotFoundException) { + $roomParameter = $this->getFormerRoom($l); } $this->setSubjects($event, $l->t('{actor} invited you to {call}'), [ diff --git a/tests/php/Activity/Provider/InvitationTest.php b/tests/php/Activity/Provider/InvitationTest.php index f6edb1c18bd..d15eb920e1c 100644 --- a/tests/php/Activity/Provider/InvitationTest.php +++ b/tests/php/Activity/Provider/InvitationTest.php @@ -192,6 +192,8 @@ public function testParse($lang, $roomExists, array $params, array $expectedPara ->method('getRoom') ->with($room, 'user') ->willReturn(['call-data']); + $provider->expects($this->never()) + ->method('getFormerRoom'); } else { $this->manager->expects($this->once()) ->method('getRoomById') @@ -200,6 +202,10 @@ public function testParse($lang, $roomExists, array $params, array $expectedPara $provider->expects($this->never()) ->method('getRoom'); + $provider->expects($this->once()) + ->method('getFormerRoom') + ->with($l) + ->willReturn(['call-unknown']); } $this->l10nFactory->expects($this->once()) @@ -218,10 +224,6 @@ public function testParse($lang, $roomExists, array $params, array $expectedPara ->method('getUser') ->with($params['user']) ->willReturn(['actor-data']); - $provider->expects($this->once()) - ->method('getFormerRoom') - ->with($l, $params['room']) - ->willReturn(['call-unknown']); $provider->parse($lang, $event); }