From: Joshua Rüsweg Date: Sat, 15 Jul 2017 20:03:05 +0000 (+0200) Subject: Add UserTrophy notification object X-Git-Tag: 3.1.0_Alpha_1~260 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e8c9589a371a2f6a2031f622ceccfd114499f6e2;p=GitHub%2FWoltLab%2FWCF.git Add UserTrophy notification object See #2315 --- diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 4b22900906..60d8105459 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -1372,6 +1372,12 @@ com.woltlab.wcf.category wcf\system\category\TrophyCategoryType + + com.woltlab.wcf.userTrophy.notification + com.woltlab.wcf.notification.objectType + wcf\system\user\notification\object\type\UserTrophyNotificationObjectType + com.woltlab.wcf.user + diff --git a/wcfsetup/install/files/lib/system/user/notification/object/UserTrophyNotificationObject.class.php b/wcfsetup/install/files/lib/system/user/notification/object/UserTrophyNotificationObject.class.php new file mode 100644 index 0000000000..0451ea714a --- /dev/null +++ b/wcfsetup/install/files/lib/system/user/notification/object/UserTrophyNotificationObject.class.php @@ -0,0 +1,44 @@ + + * @package WoltLabSuite\Core\System\User\Notification\Object + * + * @method UserTrophy getDecoratedObject() + * @mixin UserTrophy + */ +class UserTrophyNotificationObject extends DatabaseObjectDecorator implements IUserNotificationObject { + /** + * @inheritdoc + */ + protected static $baseClass = UserTrophy::class; + + /** + * @inheritdoc + */ + public function getTitle() { + return $this->getDecoratedObject()->getTrophy()->getTitle(); + } + + /** + * @inheritdoc + */ + public function getURL() { + return $this->getDecoratedObject()->getTrophy()->getLink(); + } + + /** + * @inheritdoc + */ + public function getAuthorID() { + return $this->getDecoratedObject()->userID; + } + +} diff --git a/wcfsetup/install/files/lib/system/user/notification/object/type/UserTrophyNotificationObjectType.class.php b/wcfsetup/install/files/lib/system/user/notification/object/type/UserTrophyNotificationObjectType.class.php new file mode 100644 index 0000000000..580b5a878b --- /dev/null +++ b/wcfsetup/install/files/lib/system/user/notification/object/type/UserTrophyNotificationObjectType.class.php @@ -0,0 +1,30 @@ + + * @package WoltLabSuite\Core\System\User\Notification\Object\Type + */ +class UserTrophyNotificationObjectType extends AbstractUserNotificationObjectType { + /** + * @inheritdoc + */ + protected static $decoratorClassName = UserTrophyNotificationObject::class; + + /** + * @inheritdoc + */ + protected static $objectClassName = UserTrophy::class; + + /** + * @inheritdoc + */ + protected static $objectListClassName = UserTrophyList::class; +}