From c09e68be0fa8838dfea1d96c4481b07b18b5acb3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Joshua=20R=C3=BCsweg?= Date: Fri, 27 Dec 2019 15:43:09 +0100 Subject: [PATCH] Fix reference for article comment notifications 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. --- ...entResponseOwnerUserNotificationEvent.class.php | 12 ++++++------ ...eCommentResponseUserNotificationEvent.class.php | 12 ++++++------ .../ArticleCommentUserNotificationEvent.class.php | 14 +++++++------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentResponseOwnerUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentResponseOwnerUserNotificationEvent.class.php index 9cb8be9316..f84edaed3d 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentResponseOwnerUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentResponseOwnerUserNotificationEvent.class.php @@ -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') ]; } diff --git a/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentResponseUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentResponseUserNotificationEvent.class.php index 5700e5ffb8..7ca22684fb 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentResponseUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentResponseUserNotificationEvent.class.php @@ -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') ]; } diff --git a/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentUserNotificationEvent.class.php b/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentUserNotificationEvent.class.php index 5a0680344d..58fa1792b9 100644 --- a/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentUserNotificationEvent.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/event/ArticleCommentUserNotificationEvent.class.php @@ -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') ]; } -- 2.20.1