diff --git a/.github/workflows/psalm.yml b/.github/workflows/psalm.yml index 645c1b53a17..8e7ffd0246b 100644 --- a/.github/workflows/psalm.yml +++ b/.github/workflows/psalm.yml @@ -15,7 +15,7 @@ jobs: static-analysis: runs-on: ubuntu-latest - name: Nextcloud + name: static-psalm-analysis steps: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 98a4716ab6e..675bd43725e 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -622,7 +622,7 @@ protected function parseChatMessage(INotification $notification, Room $room, Par $subject = $l->t('A guest mentioned you in conversation {call}'); } } - $notification = $this->addActionButton($notification, $l->t('View chat'), false); + $notification = $this->addActionButton($notification, 'chat_view', $l->t('View chat'), false); if ($richSubjectParameters['user'] === null) { unset($richSubjectParameters['user']); @@ -704,9 +704,9 @@ protected function parseInvitation(INotification $notification, Room $room, IL10 if ($room->getType() === Room::TYPE_ONE_TO_ONE || $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER) { $subject = $l->t('{user} invited you to a private conversation'); if ($this->participantService->hasActiveSessionsInCall($room)) { - $notification = $this->addActionButton($notification, $l->t('Join call')); + $notification = $this->addActionButton($notification, 'call_view', $l->t('Join call')); } else { - $notification = $this->addActionButton($notification, $l->t('View chat'), false); + $notification = $this->addActionButton($notification, 'chat_view', $l->t('View chat'), false); } $notification @@ -729,9 +729,9 @@ protected function parseInvitation(INotification $notification, Room $room, IL10 } elseif (\in_array($room->getType(), [Room::TYPE_GROUP, Room::TYPE_PUBLIC], true)) { $subject = $l->t('{user} invited you to a group conversation: {call}'); if ($this->participantService->hasActiveSessionsInCall($room)) { - $notification = $this->addActionButton($notification, $l->t('Join call')); + $notification = $this->addActionButton($notification, 'call_view', $l->t('Join call')); } else { - $notification = $this->addActionButton($notification, $l->t('View chat'), false); + $notification = $this->addActionButton($notification, 'chat_view', $l->t('View chat'), false); } $notification @@ -778,10 +778,10 @@ protected function parseCall(INotification $notification, Room $room, IL10N $l): $userDisplayName = $this->userManager->getDisplayName($calleeId); if ($userDisplayName !== null) { if ($this->notificationManager->isPreparingPushNotification() || $this->participantService->hasActiveSessionsInCall($room)) { - $notification = $this->addActionButton($notification, $l->t('Answer call')); + $notification = $this->addActionButton($notification, 'call_view', $l->t('Answer call')); $subject = $l->t('{user} would like to talk with you'); } else { - $notification = $this->addActionButton($notification, $l->t('Call back')); + $notification = $this->addActionButton($notification, 'call_view', $l->t('Call back')); $subject = $l->t('You missed a call from {user}'); } @@ -807,10 +807,10 @@ protected function parseCall(INotification $notification, Room $room, IL10N $l): } } elseif (\in_array($room->getType(), [Room::TYPE_GROUP, Room::TYPE_PUBLIC], true)) { if ($this->notificationManager->isPreparingPushNotification() || $this->participantService->hasActiveSessionsInCall($room)) { - $notification = $this->addActionButton($notification, $l->t('Join call')); + $notification = $this->addActionButton($notification, 'call_view', $l->t('Join call')); $subject = $l->t('A group call has started in {call}'); } else { - $notification = $this->addActionButton($notification, $l->t('View chat'), false); + $notification = $this->addActionButton($notification, 'chat_view', $l->t('View chat'), false); $subject = $l->t('You missed a group call in {call}'); } @@ -864,9 +864,9 @@ protected function parsePasswordRequest(INotification $notification, Room $room, $callIsActive = $this->notificationManager->isPreparingPushNotification() || $this->participantService->hasActiveSessionsInCall($room); if ($callIsActive) { - $notification = $this->addActionButton($notification, $l->t('Answer call')); + $notification = $this->addActionButton($notification, 'call_view', $l->t('Answer call')); } else { - $notification = $this->addActionButton($notification, $l->t('Call back')); + $notification = $this->addActionButton($notification, 'call_view', $l->t('Call back')); } if ($share->getShareType() === IShare::TYPE_EMAIL) { @@ -903,9 +903,9 @@ protected function parsePasswordRequest(INotification $notification, Room $room, return $notification; } - protected function addActionButton(INotification $notification, string $label, bool $primary = true): INotification { + protected function addActionButton(INotification $notification, string $labelKey, string $label, bool $primary = true): INotification { $action = $notification->createAction(); - $action->setLabel($label) + $action->setLabel($labelKey) ->setParsedLabel($label) ->setLink($notification->getLink(), IAction::TYPE_WEB) ->setPrimary($primary);