From: Matthias Schmidt Date: Mon, 6 May 2019 17:17:28 +0000 (+0200) Subject: Ignore guests when marking comment notifications as confirmed X-Git-Tag: 5.2.0_Alpha_1~104 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6904b5ab31a243aaf4b44833ff921808bac1bbf7;p=GitHub%2FWoltLab%2FWCF.git Ignore guests when marking comment notifications as confirmed See #2835 --- 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}'."); }