From 348f88b6ec5e13a6543dc6637a4b468170afa032 Mon Sep 17 00:00:00 2001 From: csoler Date: Thu, 13 Dec 2018 21:02:32 +0100 Subject: [PATCH] partially fixed async navigate action in forums --- .../src/gui/gxsforums/GxsForumThreadWidget.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index fb7b3d1be..06e8e4d9d 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -1494,7 +1494,10 @@ bool GxsForumThreadWidget::navigate(const RsGxsMessageId &msgId) QModelIndex source_index = mThreadModel->getIndexOfMessage(msgId); if(!source_index.isValid()) - return false; + { + mNavigatePendingMsgId = msgId; // not found. That means the forum may not be loaded yet. So we keep that post in mind, for after loading. + return true; // we have to return true here, otherwise the caller will intepret the async loading as an error. + } QModelIndex indx = mThreadProxyModel->mapFromSource(source_index); @@ -1847,6 +1850,12 @@ void GxsForumThreadWidget::postForumLoading() #ifdef DEBUG_FORUMS std::cerr << "Post forum loading..." << std::endl; #endif + if(!mNavigatePendingMsgId.isNull() && mThreadModel->getIndexOfMessage(mNavigatePendingMsgId).isValid()) + { + mThreadId = mNavigatePendingMsgId; + mNavigatePendingMsgId.clear(); + } + QModelIndex source_index = mThreadModel->getIndexOfMessage(mThreadId); if(!mThreadId.isNull() && source_index.isValid())