fixed bug causing forums to collapse when browsing messages

This commit is contained in:
csoler 2020-04-17 17:12:23 +02:00
parent b03ddda6c3
commit e351b0353d
2 changed files with 10 additions and 2 deletions

View File

@ -1213,7 +1213,7 @@ void RsGxsForumModel::setMsgReadStatus(const QModelIndex& i,bool read_status,boo
if(!i.isValid()) if(!i.isValid())
return ; return ;
preMods(); // no need to call preMods()/postMods() here because we'renot changing the model
void *ref = i.internalPointer(); void *ref = i.internalPointer();
uint32_t entry = 0; uint32_t entry = 0;
@ -1225,7 +1225,14 @@ void RsGxsForumModel::setMsgReadStatus(const QModelIndex& i,bool read_status,boo
recursSetMsgReadStatus(entry,read_status,with_children) ; recursSetMsgReadStatus(entry,read_status,with_children) ;
recursUpdateReadStatusAndTimes(0,has_unread_below,has_read_below); 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) void RsGxsForumModel::recursSetMsgReadStatus(ForumModelIndex i,bool read_status,bool with_children)

View File

@ -1722,6 +1722,7 @@ void GxsForumThreadWidget::postForumLoading()
recursRestoreExpandedItems(mThreadProxyModel->mapFromSource(mThreadModel->root()),mSavedExpandedMessages); recursRestoreExpandedItems(mThreadProxyModel->mapFromSource(mThreadModel->root()),mSavedExpandedMessages);
//mUpdating = false; //mUpdating = false;
} }
void GxsForumThreadWidget::updateGroupData() void GxsForumThreadWidget::updateGroupData()
{ {
if(groupId().isNull()) if(groupId().isNull())