From: Joshua Rüsweg Date: Wed, 15 May 2019 15:01:19 +0000 (+0200) Subject: Backport TReactionUserNotificationEvent to version 3.0 X-Git-Tag: 5.2.0_Alpha_1~19^2~2^2~1^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3b7895f2a2f260f7a6943ed4250db52dc5affa16;p=GitHub%2FWoltLab%2FWCF.git 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 --- 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(); +}