From 6904b5ab31a243aaf4b44833ff921808bac1bbf7 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Mon, 6 May 2019 19:17:28 +0200 Subject: [PATCH] Ignore guests when marking comment notifications as confirmed See #2835 --- .../lib/system/comment/CommentHandler.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php b/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php index 261b6f5771..db53f57058 100644 --- a/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php +++ b/wcfsetup/install/files/lib/system/comment/CommentHandler.class.php @@ -245,6 +245,11 @@ class CommentHandler extends SingletonFactory { * @since 5.2 */ public function markNotificationsAsConfirmed($objectType, array $objectIDs, $time = TIME_NOW) { + // notifications are only relevant for logged-in users + if (!WCF::getUser()->userID) { + return; + } + if ($this->getObjectTypeID($objectType) === null) { throw new \InvalidArgumentException("Unknown comment object type '{$objectType}'."); } @@ -448,6 +453,11 @@ class CommentHandler extends SingletonFactory { * @since 5.2 */ public function markNotificationsAsConfirmedForComments($objectType, array $comments) { + // notifications are only relevant for logged-in users + if (!WCF::getUser()->userID) { + return; + } + if ($this->getObjectTypeID($objectType) === null) { throw new \InvalidArgumentException("Unknown comment object type '{$objectType}'."); } @@ -615,6 +625,11 @@ class CommentHandler extends SingletonFactory { * @since 5.2 */ public function markNotificationsAsConfirmedForResponses($objectType, array $responses) { + // notifications are only relevant for logged-in users + if (!WCF::getUser()->userID) { + return; + } + if ($this->getObjectTypeID($objectType) === null) { throw new \InvalidArgumentException("Unknown comment object type '{$objectType}'."); } -- 2.20.1