diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp index 4e4636b8b..e9be3e6ed 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsModel.cpp @@ -66,40 +66,6 @@ void RsGxsChannelPostsModel::setMode(TreeMode mode) triggerViewUpdate(true,true); } -void RsGxsChannelPostsModel::computeCommentCounts( std::vector& posts, std::vector& comments) -{ - // Store posts IDs in a std::map to avoid a quadratic cost - - std::map post_indices; - - for(uint32_t i=0;isecond>=posts.size() is impossible by construction, since post_indices - // is previously filled using posts ids. - - if(it == post_indices.end()) - continue; - - ++posts[it->second].mCommentCount; - - if(IS_MSG_NEW(comments[i].mMeta.mMsgStatus)) - ++posts[it->second].mUnreadCommentCount; - } -} void RsGxsChannelPostsModel::initEmptyHierarchy() @@ -598,30 +564,23 @@ void RsGxsChannelPostsModel::update_posts(const RsGxsGroupId& group_id) RsGxsChannelGroup group = groups[0]; - // We use the heap because the arrays need to be stored accross async + std::vector *posts = new std::vector(); // We use the heap because the arrays need to be stored accross async + std::vector comments ; + std::vector votes ; - std::vector *posts = new std::vector(); - std::vector *comments = new std::vector(); - std::vector *votes = new std::vector(); - - if(!rsGxsChannels->getChannelAllContent(group_id, *posts,*comments,*votes)) + if(!rsGxsChannels->getChannelAllContent(group_id, *posts,comments,votes)) { std::cerr << __PRETTY_FUNCTION__ << " failed to retrieve channel messages for channel " << group_id << std::endl; return; } std::cerr << "Got channel all content for channel " << group_id << std::endl; std::cerr << " posts : " << posts->size() << std::endl; - std::cerr << " comments: " << comments->size() << std::endl; - std::cerr << " votes : " << votes->size() << std::endl; - - // This shouldn't be needed normally. We need it until a background process computes the number of comments per - // post and stores it in the service string. Since we request all data, this process isn't costing much anyway. - - computeCommentCounts(*posts,*comments); + std::cerr << " comments: " << comments.size() << std::endl; + std::cerr << " votes : " << votes.size() << std::endl; // 2 - update the model in the UI thread. - RsQThreadUtils::postToObject( [group,posts,comments,votes,this]() + RsQThreadUtils::postToObject( [group,posts,this]() { /* Here it goes any code you want to be executed on the Qt Gui * thread, for example to update the data model with new information @@ -632,8 +591,6 @@ void RsGxsChannelPostsModel::update_posts(const RsGxsGroupId& group_id) setPosts(group,*posts) ; delete posts; - delete comments; - delete votes; MainWindow::getPage(MainWindow::Channels)->setCursor(Qt::ArrowCursor) ; diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp index 1865019ec..35f8df044 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidgetWithModel.cpp @@ -821,19 +821,6 @@ void GxsChannelPostsWidgetWithModel::handleEvent_main_thread(std::shared_ptrgetChannelComments(grp_id,{ msg_id },comments)) - { - RsErr() << " failed to retrieve message comment data for channel/msg " << grp_id << "/" << msg_id ; - return; - } - - // Normally, there's a single post in the "post" array. The function below takes a full array of posts however. - - RsGxsChannelPostsModel::computeCommentCounts(posts,comments); - // 2 - update the model in the UI thread. RsQThreadUtils::postToObject( [post=posts[0],this]()