From 4239d4c54d3da132ba1ff072437f1ee0cca2dc33 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Mon, 10 Jan 2022 17:46:17 +0000 Subject: [PATCH] Fixed error on webhooks for recycle bin operations Updated the getUrl method on deletions to not require any passed params to align with usage in webhooks. Probably better to have a proper interface but would require a wider change. Fixes #3154 --- app/Entities/Models/Deletion.php | 2 +- app/Entities/Models/PageRevision.php | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/app/Entities/Models/Deletion.php b/app/Entities/Models/Deletion.php index 97abb87ff..181c9c580 100644 --- a/app/Entities/Models/Deletion.php +++ b/app/Entities/Models/Deletion.php @@ -59,7 +59,7 @@ class Deletion extends Model implements Loggable /** * Get a URL for this specific deletion. */ - public function getUrl($path): string + public function getUrl(string $path = 'restore'): string { return url("/settings/recycle-bin/{$this->id}/" . ltrim($path, '/')); } diff --git a/app/Entities/Models/PageRevision.php b/app/Entities/Models/PageRevision.php index 2bfa169f4..4daf50536 100644 --- a/app/Entities/Models/PageRevision.php +++ b/app/Entities/Models/PageRevision.php @@ -46,19 +46,10 @@ class PageRevision extends Model /** * Get the url for this revision. - * - * @param null|string $path - * - * @return string */ - public function getUrl($path = null) + public function getUrl(string $path = ''): string { - $url = $this->page->getUrl() . '/revisions/' . $this->id; - if ($path) { - return $url . '/' . trim($path, '/'); - } - - return $url; + return $this->page->getUrl('/revisions/' . $this->id . '/' . ltrim($path, '/')); } /**