From: Dan Brown Date: Mon, 10 Jan 2022 17:46:17 +0000 (+0000) Subject: Fixed error on webhooks for recycle bin operations X-Git-Tag: v21.12.2~1^2~4 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/4239d4c54d3da132ba1ff072437f1ee0cca2dc33?ds=inline;hp=--cc 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 --- 4239d4c54d3da132ba1ff072437f1ee0cca2dc33 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("/http/source.bookstackapp.com/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, '/')); } /**