Skip to content

Commit

Permalink
Merge pull request #13720 from nextcloud/backport/13593/stable28
Browse files Browse the repository at this point in the history
[stable28] fix(activity): Fix parameter type of call activity
  • Loading branch information
nickvergessen authored Nov 7, 2024
2 parents f471eca + 8e9695a commit be73841
Show file tree
Hide file tree
Showing 6 changed files with 758 additions and 45 deletions.
9 changes: 4 additions & 5 deletions lib/Activity/Provider/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,19 @@ protected function getRoom(Room $room, string $userId): array {

return [
'type' => 'call',
'id' => $room->getId(),
'id' => (string)$room->getId(),
'name' => $room->getDisplayName($userId),
'link' => $this->url->linkToRouteAbsolute('spreed.Page.showCall', ['token' => $room->getToken()]),
'call-type' => $stringType,
'icon-url' => $this->avatarService->getAvatarUrl($room),
];
}

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,
];
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Activity/Provider/Invitation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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}'), [
Expand Down
2 changes: 1 addition & 1 deletion lib/BackgroundJob/CheckHostedSignalingServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected function run($argument): void {
];
}

// only credentials have changed
// only credentials have changed
} elseif ($newStatus === 'active' && (
$oldAccountInfo['signaling']['url'] !== $accountInfo['signaling']['url'] ||
$oldAccountInfo['signaling']['secret'] !== $accountInfo['signaling']['secret'])
Expand Down
10 changes: 6 additions & 4 deletions tests/php/Activity/Provider/InvitationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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())
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions vendor-bin/csfixer/composer.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"config": {
"platform": {
"php": "8.0"
"php": "8.0.2"
},
"sort-packages": true
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.16",
"friendsofphp/php-cs-fixer": "^3.64",
"nextcloud/coding-standard": "^1.1"
}
}
Loading

0 comments on commit be73841

Please sign in to comment.