From 3b7895f2a2f260f7a6943ed4250db52dc5affa16 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Wed, 15 May 2019 17:01:19 +0200 Subject: [PATCH] Backport TReactionUserNotificationEvent to version 3.0 This backport ensures the compatibility for version 3.0 (and above) and version 5.2. With this commit, plugins can fully support the reaction system and the like system, previously this was only possible to a limited extent. See #2508 --- .../TReactionUserNotificationEvent.class.php | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/user/notification/event/TReactionUserNotificationEvent.class.php diff --git a/wcfsetup/install/files/lib/system/user/notification/event/TReactionUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/TReactionUserNotificationEvent.class.php new file mode 100644 index 0000000000..7f138d73a3 --- /dev/null +++ b/wcfsetup/install/files/lib/system/user/notification/event/TReactionUserNotificationEvent.class.php @@ -0,0 +1,56 @@ + + * @package WoltLabSuite\Core\System\User\Notification\Event + * @since 3.0 + */ +trait TReactionUserNotificationEvent { + /** + * Cached reactions + * @var int[] + */ + private $cachedReactions; + + /** + * Returns the count of reactionTypeIDs for the specific user notification object. + * + * @return int[] + * @throws \BadMethodCallException + */ + protected final function getReactionsForAuthors() { + throw new \BadMethodCallException("The method is only supported from version 5.2 and only available for compatibility reasons."); + } + + /** + * Returns the author for this notification event. + * + * @return UserProfile + */ + abstract public function getAuthor(); + + /** + * Returns a list of authors for stacked notifications sorted by time. + * + * @return UserProfile[] + */ + abstract public function getAuthors(); + + /** + * Returns the underlying user notification object. + * + * @return IUserNotificationObject + */ + abstract public function getUserNotificationObject(); +} -- 2.20.1