Use generic trait in existing notifications for article comments
authorMarcel Werk <burntime@woltlab.com>
Fri, 6 May 2022 21:47:11 +0000 (23:47 +0200)
committerMarcel Werk <burntime@woltlab.com>
Fri, 6 May 2022 21:47:11 +0000 (23:47 +0200)
wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentResponseOwnerUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentResponseUserNotificationEvent.class.php
wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentUserNotificationEvent.class.php

index a11025d35131a172666eff40ecd2f82b92808b3d..34a82743b5d46c5e060cbe90920f35a9f0d7be6c 100644 (file)
@@ -2,12 +2,10 @@
 
 namespace wcf\system\user\notification\event;
 
-use wcf\data\article\category\ArticleCategory;
 use wcf\data\user\UserProfile;
 use wcf\system\cache\runtime\CommentRuntimeCache;
 use wcf\system\cache\runtime\UserProfileRuntimeCache;
 use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache;
-use wcf\system\comment\CommentHandler;
 use wcf\system\email\Email;
 use wcf\system\user\notification\object\CommentResponseUserNotificationObject;
 
@@ -26,7 +24,7 @@ class ArticleCommentResponseOwnerUserNotificationEvent extends AbstractSharedUse
     ITestableUserNotificationEvent
 {
     use TTestableCommentResponseUserNotificationEvent;
-    use TTestableArticleUserNotificationEvent;
+    use TTestableArticleCommentUserNotificationEvent;
     use TTestableCategorizedUserNotificationEvent;
 
     /**
@@ -154,17 +152,4 @@ class ArticleCommentResponseOwnerUserNotificationEvent extends AbstractSharedUse
     {
         return \sha1($this->eventID . '-' . $this->notification->objectID);
     }
-
-    /**
-     * @inheritDoc
-     */
-    protected static function getTestCommentObjectData(UserProfile $recipient, UserProfile $author)
-    {
-        return [
-            'objectID' => self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author)
-                ->getArticleContent()
-                ->articleContentID,
-            'objectTypeID' => CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.articleComment'),
-        ];
-    }
 }
index d99a8465a7fa4c9105f4e55ec94dea47df2b4b4e..6e49b82cce4a8e8e5d0b11eed8fbe652b6413a93 100644 (file)
@@ -2,11 +2,8 @@
 
 namespace wcf\system\user\notification\event;
 
-use wcf\data\article\category\ArticleCategory;
-use wcf\data\user\UserProfile;
 use wcf\system\cache\runtime\CommentRuntimeCache;
 use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache;
-use wcf\system\comment\CommentHandler;
 use wcf\system\email\Email;
 use wcf\system\user\notification\object\CommentResponseUserNotificationObject;
 
@@ -25,7 +22,7 @@ class ArticleCommentResponseUserNotificationEvent extends AbstractSharedUserNoti
     ITestableUserNotificationEvent
 {
     use TTestableCommentResponseUserNotificationEvent;
-    use TTestableArticleUserNotificationEvent;
+    use TTestableArticleCommentUserNotificationEvent;
     use TTestableCategorizedUserNotificationEvent;
 
     /**
@@ -134,17 +131,4 @@ class ArticleCommentResponseUserNotificationEvent extends AbstractSharedUserNoti
     {
         return \sha1($this->eventID . '-' . $this->notification->objectID);
     }
-
-    /**
-     * @inheritDoc
-     */
-    protected static function getTestCommentObjectData(UserProfile $recipient, UserProfile $author)
-    {
-        return [
-            'objectID' => self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author)
-                ->getArticleContent()
-                ->articleContentID,
-            'objectTypeID' => CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.articleComment'),
-        ];
-    }
 }
index 5661542dd2655175637605296a005c0c7bd4b959..241a75bc0ae72aeaf8c9db1d6758a1a935d444b5 100644 (file)
@@ -2,10 +2,7 @@
 
 namespace wcf\system\user\notification\event;
 
-use wcf\data\article\category\ArticleCategory;
-use wcf\data\user\UserProfile;
 use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache;
-use wcf\system\comment\CommentHandler;
 use wcf\system\user\notification\object\CommentUserNotificationObject;
 
 /**
@@ -23,7 +20,7 @@ class ArticleCommentUserNotificationEvent extends AbstractSharedUserNotification
     ITestableUserNotificationEvent
 {
     use TTestableCommentUserNotificationEvent;
-    use TTestableArticleUserNotificationEvent;
+    use TTestableArticleCommentUserNotificationEvent;
     use TTestableCategorizedUserNotificationEvent;
 
     /**
@@ -120,17 +117,4 @@ class ArticleCommentUserNotificationEvent extends AbstractSharedUserNotification
     {
         return \sha1($this->eventID . '-' . $this->getUserNotificationObject()->objectID);
     }
-
-    /**
-     * @inheritDoc
-     */
-    protected static function getTestCommentObjectData(UserProfile $recipient, UserProfile $author)
-    {
-        return [
-            'objectID' => self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author)
-                ->getArticleContent()
-                ->articleContentID,
-            'objectTypeID' => CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.articleComment'),
-        ];
-    }
 }