From: Cyperghost Date: Wed, 20 Mar 2024 11:41:34 +0000 (+0100) Subject: Add user notification for new reports X-Git-Tag: 6.1.0_Alpha_1~142^2~31 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b6786f5ea0aff29ab814c5a5a38701f717b4351e;p=GitHub%2FWoltLab%2FWCF.git Add user notification for new reports --- diff --git a/com.woltlab.wcf/objectType.xml b/com.woltlab.wcf/objectType.xml index 533724022b..0b0764c64c 100644 --- a/com.woltlab.wcf/objectType.xml +++ b/com.woltlab.wcf/objectType.xml @@ -361,6 +361,12 @@ com.woltlab.wcf.comment.commentableContent wcf\system\comment\manager\ModerationQueueCommentManager + + com.woltlab.wcf.moderation.queue + com.woltlab.wcf.notification.objectType + wcf\system\user\notification\object\type\ModerationQueueUserNotificationObjectType + com.woltlab.wcf.moderation + com.woltlab.wcf.moderation.queue.notification com.woltlab.wcf.notification.objectType diff --git a/com.woltlab.wcf/userNotificationEvent.xml b/com.woltlab.wcf/userNotificationEvent.xml index 291f4373d9..3581f132be 100644 --- a/com.woltlab.wcf/userNotificationEvent.xml +++ b/com.woltlab.wcf/userNotificationEvent.xml @@ -41,6 +41,13 @@ module_like 1 + + report + com.woltlab.wcf.moderation.queue + wcf\system\user\notification\event\ReportModerationQueueUserNotificationEvent + mod.general.canUseModeration + 1 + comment com.woltlab.wcf.moderation.queue.notification diff --git a/wcfsetup/install/files/lib/system/user/notification/event/ReportModerationQueueUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/ReportModerationQueueUserNotificationEvent.class.php new file mode 100644 index 0000000000..e3afa4c4e7 --- /dev/null +++ b/wcfsetup/install/files/lib/system/user/notification/event/ReportModerationQueueUserNotificationEvent.class.php @@ -0,0 +1,68 @@ + + * @since 6.1 + * + * @method ModerationQueueUserNotificationObject getUserNotificationObject() + */ +final class ReportModerationQueueUserNotificationEvent extends AbstractUserNotificationEvent +{ + /** + * @inheritDoc + */ + protected $stackable = true; + + /** + * @inheritDoc + */ + public function getTitle(): string + { + // TODO + return ""; + } + + /** + * @inheritDoc + */ + public function getMessage() + { + // TODO + return ""; + } + + /** + * @inheritDoc + */ + public function getEmailMessage($notificationType = 'instant') + { + // TODO + } + + /** + * @inheritDoc + */ + public function getLink(): string + { + return LinkHandler::getInstance()->getLink('ModerationReport', [ + 'id' => $this->getUserNotificationObject()->queueID, + ]); + } + + /** + * @inheritDoc + */ + public function getEventHash() + { + return \sha1($this->eventID . '-' . $this->getUserNotificationObject()->queueID); + } +} diff --git a/wcfsetup/install/files/lib/system/user/notification/object/ModerationQueueUserNotificationObject.class.php b/wcfsetup/install/files/lib/system/user/notification/object/ModerationQueueUserNotificationObject.class.php new file mode 100644 index 0000000000..7351aab886 --- /dev/null +++ b/wcfsetup/install/files/lib/system/user/notification/object/ModerationQueueUserNotificationObject.class.php @@ -0,0 +1,49 @@ + + * @since 6.1 + * + * @method ModerationQueue getDecoratedObject() + * @mixin ModerationQueue + */ +final class ModerationQueueUserNotificationObject extends DatabaseObjectDecorator implements IUserNotificationObject +{ + /** + * @inheritDoc + */ + protected static $baseClass = ModerationQueue::class; + + /** + * @inheritDoc + */ + public function getTitle(): string + { + return ''; + } + + /** + * @inheritDoc + */ + public function getURL() + { + return ''; + } + + /** + * @inheritDoc + */ + public function getAuthorID() + { + return $this->userID; + } +} diff --git a/wcfsetup/install/files/lib/system/user/notification/object/type/ModerationQueueUserNotificationObjectType.class.php b/wcfsetup/install/files/lib/system/user/notification/object/type/ModerationQueueUserNotificationObjectType.class.php new file mode 100644 index 0000000000..18543f49eb --- /dev/null +++ b/wcfsetup/install/files/lib/system/user/notification/object/type/ModerationQueueUserNotificationObjectType.class.php @@ -0,0 +1,33 @@ + + * @since 6.1 + */ +final class ModerationQueueUserNotificationObjectType extends AbstractUserNotificationObjectType +{ + /** + * @inheritDoc + */ + protected static $decoratorClassName = ModerationQueueUserNotificationObject::class; + + /** + * @inheritDoc + */ + protected static $objectClassName = ModerationQueue::class; + + /** + * @inheritDoc + */ + protected static $objectListClassName = ModerationQueueList::class; +} diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 8cfd051fba..05cf36253b 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -5378,6 +5378,7 @@ Benachrichtigungen auf {PAGE_TITLE|phra + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index dac14004be..a6cb4ca94e 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -5379,6 +5379,7 @@ your notifications on {PAGE_TITLE|phras +