1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-21 21:30:08 +00:00

Make Broadcast/Team message types not inherit from PlainMessageType

This commit is contained in:
Tim Düsterhus 2022-03-04 19:29:49 +01:00
parent 5b4d97fbc8
commit e836009dbb
Signed by: TimWolla
GPG Key ID: 8FF75566094168AF
2 changed files with 24 additions and 12 deletions

View File

@ -19,23 +19,21 @@
use chat\data\room\Room; use chat\data\room\Room;
use wcf\data\user\UserProfile; use wcf\data\user\UserProfile;
use wcf\system\event\EventHandler; use wcf\system\event\EventHandler;
use wcf\system\html\output\HtmlOutputProcessor;
use wcf\system\WCF; use wcf\system\WCF;
/** /**
* BroadcastMessageType represents a broadcasted message. * BroadcastMessageType represents a broadcasted message.
*/ */
class BroadcastMessageType extends PlainMessageType class BroadcastMessageType implements IMessageType, IDeletableMessageType
{ {
/** /**
* HtmlOutputProcessor to use. * @var PlainMessageType
* @var \wcf\system\html\output\HtmlOutputProcessor
*/ */
protected $processor; protected $plainMessageType;
public function __construct() public function __construct()
{ {
$this->processor = new HtmlOutputProcessor(); $this->plainMessageType = new PlainMessageType();
} }
/** /**
@ -46,6 +44,14 @@ public function getJavaScriptModuleName()
return 'Bastelstu.be/Chat/MessageType/Broadcast'; return 'Bastelstu.be/Chat/MessageType/Broadcast';
} }
/**
* @inheritDoc
*/
public function getPayload(Message $message, ?UserProfile $user = null)
{
return $this->plainMessageType->getPayload($message, $user);
}
/** /**
* @inheritDoc * @inheritDoc
*/ */

View File

@ -19,23 +19,21 @@
use chat\data\room\Room; use chat\data\room\Room;
use wcf\data\user\UserProfile; use wcf\data\user\UserProfile;
use wcf\system\event\EventHandler; use wcf\system\event\EventHandler;
use wcf\system\html\output\HtmlOutputProcessor;
use wcf\system\WCF; use wcf\system\WCF;
/** /**
* TeamMessageType represents a team internal message. * TeamMessageType represents a team internal message.
*/ */
class TeamMessageType extends PlainMessageType class TeamMessageType implements IMessageType, IDeletableMessageType
{ {
/** /**
* HtmlOutputProcessor to use. * @var PlainMessageType
* @var \wcf\system\html\output\HtmlOutputProcessor
*/ */
protected $processor; protected $plainMessageType;
public function __construct() public function __construct()
{ {
$this->processor = new HtmlOutputProcessor(); $this->plainMessageType = new PlainMessageType();
} }
/** /**
@ -46,6 +44,14 @@ public function getJavaScriptModuleName()
return 'Bastelstu.be/Chat/MessageType/Team'; return 'Bastelstu.be/Chat/MessageType/Team';
} }
/**
* @inheritDoc
*/
public function getPayload(Message $message, ?UserProfile $user = null)
{
return $this->plainMessageType->getPayload($message, $user);
}
/** /**
* @inheritDoc * @inheritDoc
*/ */