From e351b0353d898500bfc331db401a8434b6ec7a9a Mon Sep 17 00:00:00 2001 From: csoler Date: Fri, 17 Apr 2020 17:12:23 +0200 Subject: [PATCH] fixed bug causing forums to collapse when browsing messages --- retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp | 11 +++++++++-- .../src/gui/gxsforums/GxsForumThreadWidget.cpp | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp index 4354bc183..514abd77b 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumModel.cpp @@ -1213,7 +1213,7 @@ void RsGxsForumModel::setMsgReadStatus(const QModelIndex& i,bool read_status,boo if(!i.isValid()) return ; - preMods(); + // no need to call preMods()/postMods() here because we'renot changing the model void *ref = i.internalPointer(); uint32_t entry = 0; @@ -1225,7 +1225,14 @@ void RsGxsForumModel::setMsgReadStatus(const QModelIndex& i,bool read_status,boo recursSetMsgReadStatus(entry,read_status,with_children) ; recursUpdateReadStatusAndTimes(0,has_unread_below,has_read_below); - postMods(); + // Normally we should only update the parents up to the top of the tree, but it's complicated and the update here doesn't really cost, + // so we blindly update the whole widget. + + if(mTreeMode == TREE_MODE_FLAT) + emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mPosts.size(),COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL)); + else + emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mPosts[0].mChildren.size(),COLUMN_THREAD_NB_COLUMNS-1,(void*)NULL)); + } void RsGxsForumModel::recursSetMsgReadStatus(ForumModelIndex i,bool read_status,bool with_children) diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index 173a63bc9..166b695fa 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -1722,6 +1722,7 @@ void GxsForumThreadWidget::postForumLoading() recursRestoreExpandedItems(mThreadProxyModel->mapFromSource(mThreadModel->root()),mSavedExpandedMessages); //mUpdating = false; } + void GxsForumThreadWidget::updateGroupData() { if(groupId().isNull())