diff --git a/retroshare-gui/src/gui/Posted/PostedPostsModel.cpp b/retroshare-gui/src/gui/Posted/PostedPostsModel.cpp index 89a29eec4..0f0420f20 100644 --- a/retroshare-gui/src/gui/Posted/PostedPostsModel.cpp +++ b/retroshare-gui/src/gui/Posted/PostedPostsModel.cpp @@ -72,55 +72,57 @@ void RsPostedPostsModel::handleEvent_main_thread(std::shared_ptr switch(e->mPostedEventCode) { - case RsPostedEventCode::UPDATED_MESSAGE: - case RsPostedEventCode::READ_STATUS_CHANGED: - case RsPostedEventCode::MESSAGE_VOTES_UPDATED: - case RsPostedEventCode::NEW_MESSAGE: - { - // Normally we should just emit dataChanged() on the index of the data that has changed: - // - // We need to update the data! + case RsPostedEventCode::UPDATED_MESSAGE: + case RsPostedEventCode::READ_STATUS_CHANGED: + case RsPostedEventCode::MESSAGE_VOTES_UPDATED: + case RsPostedEventCode::NEW_MESSAGE: + { + // Normally we should just emit dataChanged() on the index of the data that has changed: + // + // We need to update the data! - if(e->mPostedGroupId == mPostedGroup.mMeta.mGroupId) - RsThread::async([this, e]() - { - // 1 - get message data from p3GxsChannels + RsGxsPostedEvent E(*e); - std::vector posts; - std::vector comments; - std::vector votes; - - if(!rsPosted->getBoardContent(mPostedGroup.mMeta.mGroupId,std::set{ e->mPostedMsgId }, posts,comments,votes)) + if(E.mPostedGroupId == mPostedGroup.mMeta.mGroupId) + RsThread::async([this, E]() { - std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve channel message data for channel/msg " << e->mPostedGroupId << "/" << e->mPostedMsgId << std::endl; - return; - } + // 1 - get message data from p3GxsChannels - // 2 - update the model in the UI thread. + std::vector posts; + std::vector comments; + std::vector votes; - RsQThreadUtils::postToObject( [posts,comments,votes,this]() - { - for(uint32_t i=0;igetBoardContent(mPostedGroup.mMeta.mGroupId,std::set{ E.mPostedMsgId }, posts,comments,votes)) { - // linear search. Not good at all, but normally this is for a single post. - - for(uint32_t j=0;j