Prevent firing notifications for awarding own trophies
authorjoshuaruesweg <ruesweg@woltlab.com>
Mon, 18 Apr 2022 08:31:40 +0000 (10:31 +0200)
committerjoshuaruesweg <ruesweg@woltlab.com>
Mon, 18 Apr 2022 08:31:40 +0000 (10:31 +0200)
wcfsetup/install/files/lib/data/user/trophy/UserTrophyAction.class.php

index d4d89e13bbd33b6d37b745c905f83ff6ba133a08..05829beb22fc2a87f7736eb2de33323b8236ccb3 100644 (file)
@@ -94,14 +94,16 @@ class UserTrophyAction extends AbstractDatabaseObjectAction
             $userTrophy->userID
         );
 
-        UserNotificationHandler::getInstance()->fireEvent(
-            'received',
-            'com.woltlab.wcf.userTrophy.notification',
-            new UserTrophyNotificationObject($userTrophy),
-            [
-                $userTrophy->userID,
-            ]
-        );
+               if ($userTrophy->userID != WCF::getUser()->userID) {
+                       UserNotificationHandler::getInstance()->fireEvent(
+                               'received',
+                               'com.woltlab.wcf.userTrophy.notification',
+                               new UserTrophyNotificationObject($userTrophy),
+                               [
+                                       $userTrophy->userID,
+                               ]
+                       );
+               }
 
         return $userTrophy;
     }