From 8bf595d5830466d5f12307491a36b9088dc11fa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 4 Mar 2022 19:43:44 +0100 Subject: [PATCH] Use `->getControllerLink()` in favor of `->getLink()` --- files/lib/data/message/ViewableMessage.class.php | 6 +++--- files/lib/data/room/Room.class.php | 6 +++--- files/lib/page/LogPage.class.php | 5 ++--- files/lib/system/box/RoomListBoxController.class.php | 5 ++--- files/lib/system/page/handler/LogPageHandler.class.php | 6 +++--- 5 files changed, 13 insertions(+), 15 deletions(-) diff --git a/files/lib/data/message/ViewableMessage.class.php b/files/lib/data/message/ViewableMessage.class.php index 0e129eb..5f6345b 100644 --- a/files/lib/data/message/ViewableMessage.class.php +++ b/files/lib/data/message/ViewableMessage.class.php @@ -16,6 +16,7 @@ namespace chat\data\message; use chat\data\room\Room; +use chat\page\LogPage; use wcf\data\DatabaseObjectDecorator; use wcf\system\request\LinkHandler; use wcf\system\WCF; @@ -41,10 +42,9 @@ public function __construct(Message $message, Room $room) */ public function jsonSerialize() { - $link = LinkHandler::getInstance()->getLink( - 'Log', + $link = LinkHandler::getInstance()->getControllerLink( + LogPage::class, [ - 'application' => 'chat', 'messageid' => $this->messageID, 'object' => $this->room, ] diff --git a/files/lib/data/room/Room.class.php b/files/lib/data/room/Room.class.php index 7cb4844..d72a5de 100644 --- a/files/lib/data/room/Room.class.php +++ b/files/lib/data/room/Room.class.php @@ -15,6 +15,7 @@ namespace chat\data\room; +use chat\page\RoomPage; use chat\system\cache\runtime\UserRuntimeCache as ChatUserRuntimeCache; use chat\system\permission\PermissionHandler; use wcf\data\DatabaseObject; @@ -281,10 +282,9 @@ public function getUsers() */ public function getLink(): string { - return LinkHandler::getInstance()->getLink( - 'Room', + return LinkHandler::getInstance()->getControllerLink( + RoomPage::class, [ - 'application' => 'chat', 'object' => $this, 'forceFrontend' => true, ] diff --git a/files/lib/page/LogPage.class.php b/files/lib/page/LogPage.class.php index dcd6d73..5fa884c 100644 --- a/files/lib/page/LogPage.class.php +++ b/files/lib/page/LogPage.class.php @@ -155,11 +155,10 @@ public function readData() foreach ($objects as $message) { if ($message->getMessageType()->getProcessor()->canSeeInLog($message, $this->room)) { $parameters = [ - 'application' => 'chat', 'messageid' => $message->messageID, 'object' => $this->room, ]; - HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Log', $parameters)); + HeaderUtil::redirect(LinkHandler::getInstance()->getControllerLink(self::class, $parameters)); exit; } @@ -173,7 +172,7 @@ public function readData() 'messageid' => $minimum, 'object' => $this->room, ]; - HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Log', $parameters)); + HeaderUtil::redirect(LinkHandler::getInstance()->getControllerLink(self::class, $parameters)); exit; } diff --git a/files/lib/system/box/RoomListBoxController.class.php b/files/lib/system/box/RoomListBoxController.class.php index 3967c94..18af251 100644 --- a/files/lib/system/box/RoomListBoxController.class.php +++ b/files/lib/system/box/RoomListBoxController.class.php @@ -17,6 +17,7 @@ use chat\data\room\Room; use chat\data\room\RoomList; +use chat\page\RoomListPage; use chat\page\RoomPage; use wcf\system\box\AbstractDatabaseObjectListBoxController; use wcf\system\request\LinkHandler; @@ -92,9 +93,7 @@ public function hasLink() */ public function getLink() { - return LinkHandler::getInstance()->getLink('RoomList', [ - 'application' => 'chat', - ]); + return LinkHandler::getInstance()->getControllerLink(RoomListPage::class); } /** diff --git a/files/lib/system/page/handler/LogPageHandler.class.php b/files/lib/system/page/handler/LogPageHandler.class.php index a0a2e44..03576fe 100644 --- a/files/lib/system/page/handler/LogPageHandler.class.php +++ b/files/lib/system/page/handler/LogPageHandler.class.php @@ -16,6 +16,7 @@ namespace chat\system\page\handler; use chat\data\room\RoomCache; +use chat\page\LogPage; use wcf\data\page\Page; use wcf\data\user\online\UserOnline; use wcf\system\page\handler\AbstractLookupPageHandler; @@ -42,10 +43,9 @@ public function getLink($objectID): string throw new \InvalidArgumentException('Invalid room ID given'); } - return LinkHandler::getInstance()->getLink( - 'Log', + return LinkHandler::getInstance()->getControllerLink( + LogPage::class, [ - 'application' => 'chat', 'object' => $room, ] );