From e836009dbb1aa234a5fb241ebe699cd0cec1bb8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 4 Mar 2022 19:29:49 +0100 Subject: [PATCH] Make Broadcast/Team message types not inherit from PlainMessageType --- .../type/BroadcastMessageType.class.php | 18 ++++++++++++------ .../message/type/TeamMessageType.class.php | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/files/lib/system/message/type/BroadcastMessageType.class.php b/files/lib/system/message/type/BroadcastMessageType.class.php index f4c0c44..9cc934d 100644 --- a/files/lib/system/message/type/BroadcastMessageType.class.php +++ b/files/lib/system/message/type/BroadcastMessageType.class.php @@ -19,23 +19,21 @@ use chat\data\message\Message; use chat\data\room\Room; use wcf\data\user\UserProfile; use wcf\system\event\EventHandler; -use wcf\system\html\output\HtmlOutputProcessor; use wcf\system\WCF; /** * BroadcastMessageType represents a broadcasted message. */ -class BroadcastMessageType extends PlainMessageType +class BroadcastMessageType implements IMessageType, IDeletableMessageType { /** - * HtmlOutputProcessor to use. - * @var \wcf\system\html\output\HtmlOutputProcessor + * @var PlainMessageType */ - protected $processor; + protected $plainMessageType; public function __construct() { - $this->processor = new HtmlOutputProcessor(); + $this->plainMessageType = new PlainMessageType(); } /** @@ -46,6 +44,14 @@ class BroadcastMessageType extends PlainMessageType return 'Bastelstu.be/Chat/MessageType/Broadcast'; } + /** + * @inheritDoc + */ + public function getPayload(Message $message, ?UserProfile $user = null) + { + return $this->plainMessageType->getPayload($message, $user); + } + /** * @inheritDoc */ diff --git a/files/lib/system/message/type/TeamMessageType.class.php b/files/lib/system/message/type/TeamMessageType.class.php index 55b16f8..d69d694 100644 --- a/files/lib/system/message/type/TeamMessageType.class.php +++ b/files/lib/system/message/type/TeamMessageType.class.php @@ -19,23 +19,21 @@ use chat\data\message\Message; use chat\data\room\Room; use wcf\data\user\UserProfile; use wcf\system\event\EventHandler; -use wcf\system\html\output\HtmlOutputProcessor; use wcf\system\WCF; /** * TeamMessageType represents a team internal message. */ -class TeamMessageType extends PlainMessageType +class TeamMessageType implements IMessageType, IDeletableMessageType { /** - * HtmlOutputProcessor to use. - * @var \wcf\system\html\output\HtmlOutputProcessor + * @var PlainMessageType */ - protected $processor; + protected $plainMessageType; public function __construct() { - $this->processor = new HtmlOutputProcessor(); + $this->plainMessageType = new PlainMessageType(); } /** @@ -46,6 +44,14 @@ class TeamMessageType extends PlainMessageType return 'Bastelstu.be/Chat/MessageType/Team'; } + /** + * @inheritDoc + */ + public function getPayload(Message $message, ?UserProfile $user = null) + { + return $this->plainMessageType->getPayload($message, $user); + } + /** * @inheritDoc */