Add user notification for new reports
authorCyperghost <olaf_schmitz_1@t-online.de>
Wed, 20 Mar 2024 11:41:34 +0000 (12:41 +0100)
committerCyperghost <olaf_schmitz_1@t-online.de>
Wed, 20 Mar 2024 11:41:34 +0000 (12:41 +0100)
com.woltlab.wcf/objectType.xml
com.woltlab.wcf/userNotificationEvent.xml
wcfsetup/install/files/lib/system/user/notification/event/ReportModerationQueueUserNotificationEvent.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/user/notification/object/ModerationQueueUserNotificationObject.class.php [new file with mode: 0644]
wcfsetup/install/files/lib/system/user/notification/object/type/ModerationQueueUserNotificationObjectType.class.php [new file with mode: 0644]
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 533724022b5e67e6979a2c9921bc26c3805a548a..0b0764c64c091199e5c65b0e3f32c9c1791c63a7 100644 (file)
                        <definitionname>com.woltlab.wcf.comment.commentableContent</definitionname>
                        <classname>wcf\system\comment\manager\ModerationQueueCommentManager</classname>
                </type>
+               <type>
+                       <name>com.woltlab.wcf.moderation.queue</name>
+                       <definitionname>com.woltlab.wcf.notification.objectType</definitionname>
+                       <classname>wcf\system\user\notification\object\type\ModerationQueueUserNotificationObjectType</classname>
+                       <category>com.woltlab.wcf.moderation</category>
+               </type>
                <type>
                        <name>com.woltlab.wcf.moderation.queue.notification</name>
                        <definitionname>com.woltlab.wcf.notification.objectType</definitionname>
index 291f4373d9906185e50abde111b6954c3f65c259..3581f132bec8201c343d9e73693d9babe2a9f3f1 100644 (file)
                        <options>module_like</options>
                        <preset>1</preset>
                </event>
+               <event>
+                       <name>report</name>
+                       <objecttype>com.woltlab.wcf.moderation.queue</objecttype>
+                       <classname>wcf\system\user\notification\event\ReportModerationQueueUserNotificationEvent</classname>
+                       <permissions>mod.general.canUseModeration</permissions>
+                       <preset>1</preset>
+               </event>
                <event>
                        <name>comment</name>
                        <objecttype>com.woltlab.wcf.moderation.queue.notification</objecttype>
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 (file)
index 0000000..e3afa4c
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+
+namespace wcf\system\user\notification\event;
+
+use wcf\system\request\LinkHandler;
+use wcf\system\user\notification\object\ModerationQueueUserNotificationObject;
+
+/**
+ * Notification event for new reports in the moderation queue.
+ *
+ * @author      Olaf Braun
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..7351aab
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+
+namespace wcf\system\user\notification\object;
+
+use wcf\data\DatabaseObjectDecorator;
+use wcf\data\moderation\queue\ModerationQueue;
+
+/**
+ * Notification object for moderation queue.
+ *
+ * @author      Olaf Braun
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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 (file)
index 0000000..18543f4
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+
+namespace wcf\system\user\notification\object\type;
+
+use wcf\data\moderation\queue\ModerationQueue;
+use wcf\data\moderation\queue\ModerationQueueList;
+use wcf\system\user\notification\object\ModerationQueueUserNotificationObject;
+
+/**
+ * User notification object type implementation for moderation queue.
+ *
+ * @author      Olaf Braun
+ * @copyright   2001-2024 WoltLab GmbH
+ * @license     GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @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;
+}
index 8cfd051fba1faa42267b836193c5ebbd43299f36..05cf36253bd985bf85dc616261c0470c5e0ace31 100644 (file)
@@ -5378,6 +5378,7 @@ Benachrichtigungen auf <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|phra
                <item name="wcf.user.notification.com.woltlab.wcf.administration"><![CDATA[Administration]]></item>
                <item name="wcf.user.notification.com.woltlab.wcf.user.registration.notification.registration"><![CDATA[Neue Registrierung durch Benutzer]]></item>
                <item name="wcf.user.notification.com.woltlab.wcf.moderation"><![CDATA[Moderation]]></item>
+               <item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.report"><![CDATA[Neue Meldung]]></item>
                <item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.notification.comment"><![CDATA[Neuer Kommentar in der Moderation]]></item>
                <item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.response.notification.commentResponse"><![CDATA[Neue Antwort auf einen Kommentar in der Moderation]]></item>
                <item name="wcf.user.notification.com.woltlab.wcf.page"><![CDATA[Seiten]]></item>
index dac14004be8bb7be6e3e3f78a6d596fb59989655..a6cb4ca94eb3ac49337c128e3ce5e7cdf2802718 100644 (file)
@@ -5379,6 +5379,7 @@ your notifications on <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|phras
                <item name="wcf.user.notification.com.woltlab.wcf.administration"><![CDATA[Administration]]></item>
                <item name="wcf.user.notification.com.woltlab.wcf.user.registration.notification.registration"><![CDATA[Notify me of new user registrations]]></item>
                <item name="wcf.user.notification.com.woltlab.wcf.moderation"><![CDATA[Moderation]]></item>
+               <item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.report"><![CDATA[New report]]></item>
                <item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.notification.comment"><![CDATA[Notify me when new comments are written in moderation]]></item>
                <item name="wcf.user.notification.com.woltlab.wcf.moderation.queue.response.notification.commentResponse"><![CDATA[Notify me when new replies to comments are written in moderation]]></item>
                <item name="wcf.user.notification.com.woltlab.wcf.page"><![CDATA[Pages]]></item>