Hide empty popovers
authorMarcel Werk <burntime@woltlab.com>
Thu, 25 Jan 2024 15:57:51 +0000 (16:57 +0100)
committerMarcel Werk <burntime@woltlab.com>
Thu, 25 Jan 2024 15:57:51 +0000 (16:57 +0100)
ts/WoltLabSuite/Core/Component/Popover.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Component/Popover.js
wcfsetup/install/files/lib/action/UserPopoverAction.class.php

index 6addd292ce595d9dea533409c9d43b44b46deabf..5db2ce4c75cc6e8582df2500a8c4b79b1d9d00c0 100644 (file)
@@ -68,6 +68,10 @@ class Popover {
 
         const objectId = this.#getObjectId();
         void this.#cache.get(objectId).then((content) => {
+          if (content === "") {
+            return;
+          }
+
           const container = this.#getContainer();
           DomUtil.setInnerHtml(container, content);
 
index 3b30e185c3df9c94fcb28fa705fe63f1c76edaf9..893f0f05958dd6b74f61e65b52fe6ddd6dd07f4e 100644 (file)
@@ -53,6 +53,9 @@ define(["require", "exports", "tslib", "../Dom/Util", "../Helper/PageOverlay", "
                     timer.stop();
                     const objectId = this.#getObjectId();
                     void this.#cache.get(objectId).then((content) => {
+                        if (content === "") {
+                            return;
+                        }
                         const container = this.#getContainer();
                         Util_1.default.setInnerHtml(container, content);
                         UiAlignment.set(container, this.#element, { vertical: "top" });
index be24b6c8fff15757f4612f4f2036ddc63a93a437..c7a8b90779fcc45469949608eded16cc078d2b78 100644 (file)
@@ -2,6 +2,7 @@
 
 namespace wcf\action;
 
+use Laminas\Diactoros\Response\EmptyResponse;
 use Laminas\Diactoros\Response\HtmlResponse;
 use Psr\Http\Message\ResponseInterface;
 use Psr\Http\Message\ServerRequestInterface;
@@ -31,15 +32,13 @@ final class UserPopoverAction implements RequestHandlerInterface
                     EOT,
         );
 
-        $userProfile = UserProfileRuntimeCache::getInstance()->getObject($parameters['id']);
-        if ($userProfile) {
-            WCF::getTPL()->assign('user', $userProfile);
-        } else {
-            WCF::getTPL()->assign('unknownUser', true);
+        $user = UserProfileRuntimeCache::getInstance()->getObject($parameters['id']);
+        if (!$user) {
+            return new EmptyResponse();
         }
 
         return new HtmlResponse(
-            WCF::getTPL()->fetch('userProfilePreview'),
+            WCF::getTPL()->fetch('userCard', 'wcf', ['user' => $user]),
         );
     }
 }