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\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
*/

View File

@ -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
*/