Refresh the internal data of cached reactions
authorAlexander Ebert <ebert@woltlab.com>
Sat, 16 Sep 2023 10:22:42 +0000 (12:22 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 16 Sep 2023 10:22:42 +0000 (12:22 +0200)
See https://www.woltlab.com/community/thread/301627-when-changing-the-reaction-image-the-file-is-not-updated-in-the-dashboard/

wcfsetup/install/files/lib/data/reaction/type/ReactionType.class.php

index b5a6f94c664329f7584472f8d9838634e3d8b851..125c2df77620f29202dade512704896b5d053545 100644 (file)
@@ -4,6 +4,7 @@ namespace wcf\data\reaction\type;
 
 use wcf\data\DatabaseObject;
 use wcf\data\ITitledObject;
+use wcf\system\reaction\ReactionHandler;
 use wcf\system\WCF;
 
 /**
@@ -27,6 +28,18 @@ class ReactionType extends DatabaseObject implements ITitledObject
      */
     protected static $databaseTableIndexName = 'reactionTypeID';
 
+    /**
+     * @inheritDoc
+     */
+    public function __wakeup()
+    {
+        $reaction = ReactionHandler::getInstance()->getReactionTypeByID($this->reactionTypeID);
+        if ($reaction) {
+            $this->title = $reaction->title;
+            $this->iconFile = $reaction->iconFile;
+        }
+    }
+
     /**
      * @inheritDoc
      */