[network/ruqola] src/widgets/room: Fix hide preview if commandfailed or don't start

Laurent Montel <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 088638953dc5ab5bf14821062b147a1a7efe427e by Laurent Montel.
Committed on 14/08/2026 at 21:12.
Pushed by mlaurent into branch 'master'.

Fix hide preview if commandfailed or don't start

M  +10   -0    src/widgets/room/commandpreviewwidget.cpp

https://invent.kde.org/network/ruqola/-/commit/088638953dc5ab5bf14821062b147a1a7efe427e

diff --git a/src/widgets/room/commandpreviewwidget.cpp b/src/widgets/room/commandpreviewwidget.cpp
index 4d2e82a8c4..a2fd6baed6 100644
--- a/src/widgets/room/commandpreviewwidget.cpp
+++ b/src/widgets/room/commandpreviewwidget.cpp
@@ -104,9 +104,19 @@ void CommandPreviewWidget::setPreviewCommandInfo(const RocketChatRestApi::Previe
             }
             slotParsePreviewCommandItems(replyObject);
         });
+        connect(job,
+                &RocketChatRestApi::PreviewsCommandJob::previewsCommandFailed,
+                this,
+                [this, requestToken](const RocketChatRestApi::PreviewsCommandJob::PreviewsCommandInfo &) {
+                    if (requestToken != mPreviewRequestToken) {
+                        return;
+                    }
+                    hidePreview();
+                });
 
         if (!job->start()) {
             qCDebug(RUQOLAWIDGETS_LOG) << "Impossible to start PreviewsCommandJob job";
+            hidePreview();
         }
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.