Skip to content
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
fix(notification): Make sure the action URL is an absolute URL
The URL needs to be absolute to work also on mobile and desktop clients.

Signed-off-by: Ferdinand Thiessen <[email protected]>
  • Loading branch information
susnux authored and backportbot[bot] committed Nov 19, 2024
commit cb11317155205c95319ccd37d24c152987d987cc
21 changes: 4 additions & 17 deletions lib/Service/NotificationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ public function notificationInvited(Member $member): void {
);

$declineAction = $notification->createAction();
$declineUrl = $this->linkToOCS('circles.Local.circleLeave', ['circleId' => $member->getCircleId()]);
$declineUrl = $this->urlGenerator->linkToOCSRouteAbsolute('circles.Local.circleLeave', ['circleId' => $member->getCircleId()]);
$declineAction->setLabel('refuse')
->setLink($declineUrl, 'PUT');
$notification->addAction($declineAction);

$acceptAction = $notification->createAction();
$acceptUrl = $this->linkToOCS('circles.Local.circleJoin', ['circleId' => $member->getCircleId()]);
$acceptUrl = $this->urlGenerator->linkToOCSRouteAbsolute('circles.Local.circleJoin', ['circleId' => $member->getCircleId()]);
$acceptAction->setLabel('accept')
->setLink($acceptUrl, 'PUT');
$notification->addAction($acceptAction);
Expand Down Expand Up @@ -149,7 +149,7 @@ public function notificationRequested(Member $member): void {
);

$declineAction = $notification->createAction();
$declineUrl = $this->linkToOCS(
$declineUrl = $this->urlGenerator->linkToOCSRouteAbsolute(
'circles.Local.memberRemove',
[
'circleId' => $member->getCircleId(),
Expand All @@ -161,7 +161,7 @@ public function notificationRequested(Member $member): void {
$notification->addAction($declineAction);

$acceptAction = $notification->createAction();
$acceptUrl = $this->linkToOCS(
$acceptUrl = $this->urlGenerator->linkToOCSRouteAbsolute(
'circles.Local.memberConfirm',
[
'circleId' => $member->getCircleId(),
Expand Down Expand Up @@ -216,19 +216,6 @@ private function createMemberNotification(
return $notification;
}


/**
* @param string $route
* @param array $params
*
* @return string
*/
private function linkToOCS(string $route, array $params = []): string {
$absolute = $this->urlGenerator->linkToOCSRouteAbsolute($route, $params);

return parse_url($absolute, PHP_URL_PATH);
}

public function markInvitationAsProcessed(Member $member): void {
if ($member->getUserType() !== Member::TYPE_USER || !$member->isLocal()) {
return;
Expand Down
Loading