Fix reference for article comment notifications
authorJoshua Rüsweg <ruesweg@woltlab.com>
Fri, 27 Dec 2019 14:43:09 +0000 (15:43 +0100)
committerJoshua Rüsweg <ruesweg@woltlab.com>
Fri, 27 Dec 2019 14:43:09 +0000 (15:43 +0100)
Until now, the notifications were bound to the article object. However, the actual comments are bound to the article content object. This has now been corrected and the notification itself is now also bound to the article content object.

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 9cb8be9316d61d78e0019c839f5c791184f058d9..f84edaed3df11c3997c56a79eefb009b73956bb9 100644 (file)
@@ -4,7 +4,7 @@ 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\ViewableArticleRuntimeCache;
+use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache;
 use wcf\system\comment\CommentHandler;
 use wcf\system\email\Email;
 use wcf\system\user\notification\object\CommentUserNotificationObject;
@@ -67,7 +67,7 @@ class ArticleCommentResponseOwnerUserNotificationEvent extends AbstractSharedUse
                                'author' => $this->author,
                                'authors' => array_values($authors),
                                'commentID' => $this->getUserNotificationObject()->commentID,
-                               'article' => ViewableArticleRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
+                               'article' => ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
                                'count' => $count,
                                'others' => $count - 1,
                                'guestTimesTriggered' => $this->notification->guestTimesTriggered,
@@ -79,7 +79,7 @@ class ArticleCommentResponseOwnerUserNotificationEvent extends AbstractSharedUse
                return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.responseOwner.message', [
                        'author' => $this->author,
                        'commentID' => $this->getUserNotificationObject()->commentID,
-                       'article' => ViewableArticleRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
+                       'article' => ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
                        'responseID' => $this->getUserNotificationObject()->responseID,
                        'commentAuthor' => $this->getCommentAuthorProfile()
                ]);
@@ -98,7 +98,7 @@ class ArticleCommentResponseOwnerUserNotificationEvent extends AbstractSharedUse
                        'application' => 'wcf',
                        'variables' => [
                                'commentID' => $this->getUserNotificationObject()->commentID,
-                               'article' => ViewableArticleRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
+                               'article' => ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
                                'languageVariablePrefix' => 'wcf.user.notification.articleComment.responseOwner',
                                'responseID' => $this->getUserNotificationObject()->responseID,
                                'commentAuthor' => $this->getCommentAuthorProfile(),
@@ -126,7 +126,7 @@ class ArticleCommentResponseOwnerUserNotificationEvent extends AbstractSharedUse
         * @inheritDoc
         */
        public function getLink() {
-               return ViewableArticleRuntimeCache::getInstance()->getObject($this->additionalData['objectID'])->getLink() . '#comment'. $this->getUserNotificationObject()->commentID;
+               return ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID'])->getLink() . '#comment'. $this->getUserNotificationObject()->commentID .'/response'. $this->getUserNotificationObject()->responseID;
        }
        
        /**
@@ -141,7 +141,7 @@ class ArticleCommentResponseOwnerUserNotificationEvent extends AbstractSharedUse
         */
        protected static function getTestCommentObjectData(UserProfile $recipient, UserProfile $author) {
                return [
-                       'objectID' => self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author)->articleID,
+                       'objectID' => self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author)->getArticleContent()->articleContentID,
                        'objectTypeID' => CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.articleComment')
                ];
        }
index 5700e5ffb8889369eb8df64a320afe83dd7e5c03..7ca22684fb33975acb11ea2b1c8fde442cc4a898 100644 (file)
@@ -3,7 +3,7 @@ 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\ViewableArticleRuntimeCache;
+use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache;
 use wcf\system\comment\CommentHandler;
 use wcf\system\email\Email;
 use wcf\system\user\notification\object\CommentUserNotificationObject;
@@ -66,7 +66,7 @@ class ArticleCommentResponseUserNotificationEvent extends AbstractSharedUserNoti
                                'author' => $this->author,
                                'authors' => array_values($authors),
                                'commentID' => $this->getUserNotificationObject()->commentID,
-                               'article' => ViewableArticleRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
+                               'article' => ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
                                'count' => $count,
                                'others' => $count - 1,
                                'guestTimesTriggered' => $this->notification->guestTimesTriggered,
@@ -77,7 +77,7 @@ class ArticleCommentResponseUserNotificationEvent extends AbstractSharedUserNoti
                return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.response.message', [
                        'author' => $this->author,
                        'commentID' => $this->getUserNotificationObject()->commentID,
-                       'article' => ViewableArticleRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
+                       'article' => ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
                        'responseID' => $this->getUserNotificationObject()->responseID
                ]);
        }
@@ -95,7 +95,7 @@ class ArticleCommentResponseUserNotificationEvent extends AbstractSharedUserNoti
                        'application' => 'wcf',
                        'variables' => [
                                'commentID' => $this->getUserNotificationObject()->commentID,
-                               'article' => ViewableArticleRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
+                               'article' => ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID']),
                                'languageVariablePrefix' => 'wcf.user.notification.articleComment.response',
                                'responseID' => $this->getUserNotificationObject()->responseID
                        ]
@@ -106,7 +106,7 @@ class ArticleCommentResponseUserNotificationEvent extends AbstractSharedUserNoti
         * @inheritDoc
         */
        public function getLink() {
-               return ViewableArticleRuntimeCache::getInstance()->getObject($this->additionalData['objectID'])->getLink() . '#comment'. $this->getUserNotificationObject()->commentID;
+               return ViewableArticleContentRuntimeCache::getInstance()->getObject($this->additionalData['objectID'])->getLink() . '#comment'. $this->getUserNotificationObject()->commentID .'/response'. $this->getUserNotificationObject()->responseID;
        }
        
        /**
@@ -121,7 +121,7 @@ class ArticleCommentResponseUserNotificationEvent extends AbstractSharedUserNoti
         */
        protected static function getTestCommentObjectData(UserProfile $recipient, UserProfile $author) {
                return [
-                       'objectID' => self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author)->articleID,
+                       'objectID' => self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author)->getArticleContent()->articleContentID,
                        'objectTypeID' => CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.articleComment')
                ];
        }
index 5a0680344d2b3c6613d9fa938cf38e725fb251ba..58fa1792b940ec4d56db8f456af37b06216f7e4e 100644 (file)
@@ -2,7 +2,7 @@
 namespace wcf\system\user\notification\event;
 use wcf\data\article\category\ArticleCategory;
 use wcf\data\user\UserProfile;
-use wcf\system\cache\runtime\ViewableArticleRuntimeCache;
+use wcf\system\cache\runtime\ViewableArticleContentRuntimeCache;
 use wcf\system\comment\CommentHandler;
 use wcf\system\user\notification\object\CommentUserNotificationObject;
 
@@ -31,7 +31,7 @@ class ArticleCommentUserNotificationEvent extends AbstractSharedUserNotification
         * @inheritDoc
         */
        protected function prepare() {
-               ViewableArticleRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->objectID);
+               ViewableArticleContentRuntimeCache::getInstance()->cacheObjectID($this->getUserNotificationObject()->objectID);
        }
        
        /**
@@ -64,7 +64,7 @@ class ArticleCommentUserNotificationEvent extends AbstractSharedUserNotification
                                'author' => $this->author,
                                'authors' => array_values($authors),
                                'commentID' => $this->getUserNotificationObject()->commentID,
-                               'article' => ViewableArticleRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID),
+                               'article' => ViewableArticleContentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID),
                                'count' => $count,
                                'others' => $count - 1,
                                'guestTimesTriggered' => $this->notification->guestTimesTriggered
@@ -74,7 +74,7 @@ class ArticleCommentUserNotificationEvent extends AbstractSharedUserNotification
                return $this->getLanguage()->getDynamicVariable('wcf.user.notification.articleComment.message', [
                        'author' => $this->author,
                        'commentID' => $this->getUserNotificationObject()->commentID,
-                       'article' => ViewableArticleRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID)
+                       'article' => ViewableArticleContentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID)
                ]);
        }
        
@@ -88,7 +88,7 @@ class ArticleCommentUserNotificationEvent extends AbstractSharedUserNotification
                        'application' => 'wcf',
                        'variables' => [
                                'commentID' => $this->getUserNotificationObject()->commentID,
-                               'article' => ViewableArticleRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID),
+                               'article' => ViewableArticleContentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID),
                                'languageVariablePrefix' => 'wcf.user.notification.articleComment'
                        ]
                ];
@@ -98,7 +98,7 @@ class ArticleCommentUserNotificationEvent extends AbstractSharedUserNotification
         * @inheritDoc
         */
        public function getLink() {
-               return ViewableArticleRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID)->getLink() . '#comment'. $this->getUserNotificationObject()->commentID;
+               return ViewableArticleContentRuntimeCache::getInstance()->getObject($this->getUserNotificationObject()->objectID)->getLink() . '#comment'. $this->getUserNotificationObject()->commentID;
        }
        
        /**
@@ -113,7 +113,7 @@ class ArticleCommentUserNotificationEvent extends AbstractSharedUserNotification
         */
        protected static function getTestCommentObjectData(UserProfile $recipient, UserProfile $author) {
                return [
-                       'objectID' => self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author)->articleID,
+                       'objectID' => self::getTestArticle(self::createTestCategory(ArticleCategory::OBJECT_TYPE_NAME), $author)->getArticleContent()->articleContentID,
                        'objectTypeID' => CommentHandler::getInstance()->getObjectTypeID('com.woltlab.wcf.articleComment')
                ];
        }