From 7fde0b67a5834716d131c70db595cf29837bb6d5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 4 Jun 2016 01:20:43 +0200 Subject: [PATCH] Added additional callback during quick reply Allows to inject additional data before reading the message list. --- .../files/lib/system/message/QuickReplyManager.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php b/wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php index bf4c965464..9cc3f4d656 100644 --- a/wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php +++ b/wcfsetup/install/files/lib/system/message/QuickReplyManager.class.php @@ -176,9 +176,10 @@ class QuickReplyManager extends SingletonFactory { * @param string $sortOrder * @param string $templateName * @param string $application + * @param callable $callbackCreatedMessage * @return array */ - public function createMessage(IMessageQuickReplyAction $object, array &$parameters, $containerActionClassName, $sortOrder, $templateName, $application = 'wcf') { + public function createMessage(IMessageQuickReplyAction $object, array &$parameters, $containerActionClassName, $sortOrder, $templateName, $application = 'wcf', callable $callbackCreatedMessage = null) { $additionalFields = []; EventHandler::getInstance()->fireAction($this, 'createMessage', $additionalFields); @@ -205,6 +206,10 @@ class QuickReplyManager extends SingletonFactory { $eventParameters = ['message' => $message]; EventHandler::getInstance()->fireAction($this, 'createdMessage', $eventParameters); + if ($callbackCreatedMessage !== null) { + $callbackCreatedMessage($message); + } + if ($message instanceof IMessage && !$message->isVisible()) { return ['isVisible' => false]; } -- 2.20.1