From f6260a95ae2e7baee7877f984d569c291b459612 Mon Sep 17 00:00:00 2001 From: Phenom Date: Mon, 27 Apr 2020 17:24:36 +0200 Subject: [PATCH] Add Votes when calling getPostData. --- libretroshare/src/retroshare/rsgxschannels.h | 10 +- libretroshare/src/retroshare/rsposted.h | 11 +- libretroshare/src/services/p3gxschannels.cc | 93 ++++++++---- libretroshare/src/services/p3gxschannels.h | 15 +- libretroshare/src/services/p3posted.cc | 141 +++++++++++------- libretroshare/src/services/p3posted.h | 19 ++- retroshare-gui/src/gui/Posted/PostedItem.cpp | 6 +- .../src/gui/Posted/PostedListWidget.cpp | 6 +- .../src/gui/feeds/GxsChannelPostItem.cpp | 3 +- .../gui/gxschannels/CreateGxsChannelMsg.cpp | 13 +- .../gui/gxschannels/GxsChannelPostsWidget.cpp | 8 +- 11 files changed, 208 insertions(+), 117 deletions(-) diff --git a/libretroshare/src/retroshare/rsgxschannels.h b/libretroshare/src/retroshare/rsgxschannels.h index 0fcde2960..bef322a4a 100644 --- a/libretroshare/src/retroshare/rsgxschannels.h +++ b/libretroshare/src/retroshare/rsgxschannels.h @@ -314,7 +314,8 @@ public: */ virtual bool getChannelAllContent( const RsGxsGroupId& channelId, std::vector& posts, - std::vector& comments ) = 0; + std::vector& comments, + std::vector& votes ) = 0; /** * @brief Get channel messages and comments corresponding to the given IDs. @@ -326,12 +327,14 @@ public: * @param[in] contentsIds ids of requested contents * @param[out] posts storage for posts * @param[out] comments storage for the comments + * @param[out] votes storage for the votes * @return false if something failed, true otherwhise */ virtual bool getChannelContent( const RsGxsGroupId& channelId, const std::set& contentsIds, std::vector& posts, - std::vector& comments ) = 0; + std::vector& comments, + std::vector& votes ) = 0; /** * @brief Get channel comments corresponding to the given IDs. @@ -571,6 +574,9 @@ public: RS_DEPRECATED_FOR(getChannelsInfo) virtual bool getGroupData(const uint32_t &token, std::vector &groups) = 0; + RS_DEPRECATED_FOR(getChannelContent) + virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts, std::vector &votes) = 0; + RS_DEPRECATED_FOR(getChannelContent) virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) = 0; diff --git a/libretroshare/src/retroshare/rsposted.h b/libretroshare/src/retroshare/rsposted.h index 1a089de8e..4cd6e8cf4 100644 --- a/libretroshare/src/retroshare/rsposted.h +++ b/libretroshare/src/retroshare/rsposted.h @@ -154,13 +154,15 @@ public: virtual bool getBoardAllContent( const RsGxsGroupId& boardId, std::vector& posts, - std::vector& comments ) = 0; + std::vector& comments, + std::vector& votes ) = 0; virtual bool getBoardContent( const RsGxsGroupId& boardId, const std::set& contentsIds, std::vector& posts, - std::vector& comments ) = 0; + std::vector& comments, + std::vector& votes ) = 0; virtual bool editBoard(RsPostedGroup& board) =0; @@ -176,6 +178,11 @@ public: virtual bool getGroupData( const uint32_t& token, std::vector &groups ) = 0; + RS_DEPRECATED_FOR(getBoardsContent) + virtual bool getPostData( + const uint32_t& token, std::vector& posts, + std::vector& cmts, std::vector& vots) = 0; + RS_DEPRECATED_FOR(getBoardsContent) virtual bool getPostData( const uint32_t& token, std::vector& posts, diff --git a/libretroshare/src/services/p3gxschannels.cc b/libretroshare/src/services/p3gxschannels.cc index a813c92e8..8ec075cb2 100644 --- a/libretroshare/src/services/p3gxschannels.cc +++ b/libretroshare/src/services/p3gxschannels.cc @@ -471,22 +471,23 @@ bool p3GxsChannels::groupShareKeys( bool p3GxsChannels::getPostData( const uint32_t &token, std::vector &msgs, - std::vector &cmts ) + std::vector &cmts, + std::vector &vots) { #ifdef GXSCHANNELS_DEBUG - std::cerr << __PRETTY_FUNCTION__ << std::cerr << std::endl; + RsDbg() << __PRETTY_FUNCTION__ << std::endl; #endif GxsMsgDataMap msgData; if(!RsGenExchange::getMsgData(token, msgData)) { - std::cerr << __PRETTY_FUNCTION__ <<" ERROR in request" << std::endl; + RsErr() << __PRETTY_FUNCTION__ << " ERROR in request" << std::endl; return false; } GxsMsgDataMap::iterator mit = msgData.begin(); - for(; mit != msgData.end(); ++mit) + for(; mit != msgData.end(); ++mit) { std::vector& msgItems = mit->second; std::vector::iterator vit = msgItems.begin(); @@ -514,7 +515,7 @@ bool p3GxsChannels::getPostData( cmt = cmtItem->mMsg; cmt.mMeta = mi->meta; #ifdef GXSCOMMENT_DEBUG - std::cerr << "p3GxsChannels::getPostData Found Comment:" << std::endl; + RsDbg() << __PRETTY_FUNCTION__ << " Found Comment:" << std::endl; cmt.print(std::cerr," ", "cmt"); #endif cmts.push_back(cmt); @@ -522,18 +523,33 @@ bool p3GxsChannels::getPostData( } else { - RsGxsMsgItem* msg = (*vit); - //const uint16_t RS_SERVICE_GXS_TYPE_CHANNELS = 0x0217; - //const uint8_t RS_PKT_SUBTYPE_GXSCHANNEL_POST_ITEM = 0x03; - //const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM = 0xf1; - std::cerr << __PRETTY_FUNCTION__ - << " Not a GxsChannelPostItem neither a " - << "RsGxsCommentItem PacketService=" << std::hex - << (int)msg->PacketService() << std::dec - << " PacketSubType=" << std::hex - << (int)msg->PacketSubType() << std::dec - << " , deleting!" << std::endl; - delete *vit; + RsGxsVoteItem* votItem = + dynamic_cast(*vit); + if(votItem) + { + RsGxsVote vot; + RsGxsMsgItem *mi = (*vit); + vot = votItem->mMsg; + vot.mMeta = mi->meta; + vots.push_back(vot); + delete votItem; + } + else + { + RsGxsMsgItem* msg = (*vit); + //const uint16_t RS_SERVICE_GXS_TYPE_CHANNELS = 0x0217; + //const uint8_t RS_PKT_SUBTYPE_GXSCHANNEL_POST_ITEM = 0x03; + //const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM = 0xf1; + //const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_VOTE_ITEM = 0xf2; + RsErr() << __PRETTY_FUNCTION__ + << " Not a GxsChannelPostItem neither a " + << "RsGxsCommentItem neither a RsGxsVoteItem" + << " PacketService=" << std::hex << (int)msg->PacketService() << std::dec + << " PacketSubType=" << std::hex << (int)msg->PacketSubType() << std::dec + << " type name =" << typeid(*msg).name() + << " , deleting!" << std::endl; + delete *vit; + } } } } @@ -542,11 +558,19 @@ bool p3GxsChannels::getPostData( return true; } +bool p3GxsChannels::getPostData( + const uint32_t& token, std::vector& posts, std::vector& cmts ) +{ + std::vector vots; + return getPostData(token, posts, cmts, vots); +} + bool p3GxsChannels::getPostData( const uint32_t& token, std::vector& posts ) { std::vector cmts; - return getPostData(token, posts, cmts); + std::vector vots; + return getPostData(token, posts, cmts, vots); } //Not currently used @@ -1112,22 +1136,24 @@ bool p3GxsChannels::getContentSummaries( bool p3GxsChannels::getChannelAllContent( const RsGxsGroupId& channelId, std::vector& posts, - std::vector& comments ) + std::vector& comments, + std::vector& votes ) { uint32_t token; RsTokReqOptions opts; opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; - if( !requestMsgInfo(token, opts,std::list({channelId})) || waitToken(token) != RsTokenService::COMPLETE ) - return false; + if( !requestMsgInfo(token, opts,std::list({channelId})) || waitToken(token) != RsTokenService::COMPLETE ) + return false; - return getPostData(token, posts, comments); + return getPostData(token, posts, comments,votes); } bool p3GxsChannels::getChannelContent( const RsGxsGroupId& channelId, const std::set& contentIds, std::vector& posts, - std::vector& comments ) + std::vector& comments, + std::vector& votes ) { uint32_t token; RsTokReqOptions opts; @@ -1139,7 +1165,7 @@ bool p3GxsChannels::getChannelContent( const RsGxsGroupId& channelId, if( !requestMsgInfo(token, opts, msgIds) || waitToken(token) != RsTokenService::COMPLETE ) return false; - return getPostData(token, posts, comments); + return getPostData(token, posts, comments, votes); } bool p3GxsChannels::getChannelComments(const RsGxsGroupId &channelId, @@ -1314,8 +1340,9 @@ bool p3GxsChannels::createVoteV2( std::set s({commentId}); std::vector posts; std::vector comments; + std::vector votes; - if(!getChannelContent(channelId, s, posts, comments)) + if(!getChannelContent(channelId, s, posts, comments, votes)) { errorMessage = "You cannot vote on comment " + commentId.toStdString() + " of channel with Id " @@ -1475,8 +1502,9 @@ bool p3GxsChannels::createPostV2( std::set s({origPostId}); std::vector posts; std::vector comments; + std::vector votes; - if(!getChannelContent(channelId,s,posts,comments)) + if(!getChannelContent(channelId,s,posts,comments,votes)) { errorMessage = "You cannot edit post " + origPostId.toStdString() + " of channel with Id " + channelId.toStdString() @@ -1546,9 +1574,11 @@ bool p3GxsChannels::createCommentV2( std::vector posts; std::vector comments; + std::vector votes; if(!getChannelContent( // does the post thread exist? - channelId,std::set({threadId}), posts, comments )) + channelId, std::set({threadId}), + posts, comments, votes) ) return failure( "You cannot comment post " + threadId.toStdString() + " of channel with Id " + channelId.toStdString() + ": this post does not exists locally!" ); @@ -1560,19 +1590,18 @@ bool p3GxsChannels::createCommentV2( ": supplied threadId is not a thread, or parentMsgId is" " not a comment!"); - if(!getChannelContent( // does the post thread exist? + if(!getChannelContent( // does the post parent exist? channelId, std::set({parentId}), - posts, comments )) + posts, comments, votes) ) return failure( "You cannot comment post " + parentId.toStdString() + ": supplied parent doesn't exists locally!" ); if(!origCommentId.isNull()) { std::set s({origCommentId}); - std::vector posts; - std::vector comments; + std::vector cmts; - if( !getChannelContent(channelId, s, posts, comments) || + if( !getChannelContent(channelId, s, posts, cmts, votes) || comments.size() != 1 ) return failure( "You cannot edit comment " + origCommentId.toStdString() + diff --git a/libretroshare/src/services/p3gxschannels.h b/libretroshare/src/services/p3gxschannels.h index d85372e65..e6917e252 100644 --- a/libretroshare/src/services/p3gxschannels.h +++ b/libretroshare/src/services/p3gxschannels.h @@ -82,9 +82,10 @@ virtual void handle_event(uint32_t event_type, const std::string &elabel); public: -virtual bool getGroupData(const uint32_t &token, std::vector &groups); -virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts); -virtual bool getPostData(const uint32_t &token, std::vector &posts); +virtual bool getGroupData(const uint32_t &token, std::vector &groups ) override; +virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts, std::vector &vots) override; +virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) override; +virtual bool getPostData(const uint32_t &token, std::vector &posts) override; //Not currently used //virtual bool getRelatedPosts(const uint32_t &token, std::vector &posts); @@ -187,14 +188,16 @@ virtual bool ExtraFileRemove(const RsFileHash &hash); /// Implementation of @see RsGxsChannels::getChannelAllMessages bool getChannelAllContent(const RsGxsGroupId& channelId, - std::vector& posts, - std::vector& comments ) override; + std::vector& posts, + std::vector& comments, + std::vector& votes ) override; /// Implementation of @see RsGxsChannels::getChannelMessages bool getChannelContent(const RsGxsGroupId& channelId, const std::set& contentIds, std::vector& posts, - std::vector& comments ) override; + std::vector& comments, + std::vector& votes ) override; /// Implementation of @see RsGxsChannels::getChannelComments virtual bool getChannelComments(const RsGxsGroupId &channelId, diff --git a/libretroshare/src/services/p3posted.cc b/libretroshare/src/services/p3posted.cc index db1de62ca..88ff25808 100644 --- a/libretroshare/src/services/p3posted.cc +++ b/libretroshare/src/services/p3posted.cc @@ -94,55 +94,75 @@ bool p3Posted::getGroupData(const uint32_t &token, std::vector &g return ok; } -bool p3Posted::getPostData(const uint32_t &token, std::vector &msgs, std::vector &cmts) +bool p3Posted::getPostData( + const uint32_t &token, std::vector &msgs, + std::vector &cmts, + std::vector &vots) { #ifdef POSTED_DEBUG - std::cerr << "p3Posted::getPostData()"; - std::cerr << std::endl; + RsDbg() << __PRETTY_FUNCTION__ << std::endl; #endif GxsMsgDataMap msgData; - bool ok = RsGenExchange::getMsgData(token, msgData); rstime_t now = time(NULL); - - if(ok) + if(!RsGenExchange::getMsgData(token, msgData)) { - GxsMsgDataMap::iterator mit = msgData.begin(); - - for(; mit != msgData.end(); ++mit) + RsErr() << __PRETTY_FUNCTION__ << " ERROR in request" << std::endl; + return false; + } + + GxsMsgDataMap::iterator mit = msgData.begin(); + + for(; mit != msgData.end(); ++mit) + { + std::vector& msgItems = mit->second; + std::vector::iterator vit = msgItems.begin(); + + for(; vit != msgItems.end(); ++vit) { - std::vector& msgItems = mit->second; - std::vector::iterator vit = msgItems.begin(); - - for(; vit != msgItems.end(); ++vit) + RsGxsPostedPostItem* postItem = + dynamic_cast(*vit); + + if(postItem) { - RsGxsPostedPostItem* postItem = dynamic_cast(*vit); + // TODO Really needed all of these lines? + RsPostedPost msg = postItem->mPost; + msg.mMeta = postItem->meta; + postItem->toPostedPost(msg, true); + msg.calculateScores(now); - if(postItem) + msgs.push_back(msg); + delete postItem; + } + else + { + RsGxsCommentItem* cmtItem = + dynamic_cast(*vit); + if(cmtItem) { - RsPostedPost msg = postItem->mPost; - msg.mMeta = postItem->meta; - postItem->toPostedPost(msg, true); - msg.calculateScores(now); - - msgs.push_back(msg); - delete postItem; + RsGxsComment cmt; + RsGxsMsgItem *mi = (*vit); + cmt = cmtItem->mMsg; + cmt.mMeta = mi->meta; +#ifdef GXSCOMMENT_DEBUG + RsDbg() << __PRETTY_FUNCTION__ << " Found Comment:" << std::endl; + cmt.print(std::cerr," ", "cmt"); +#endif + cmts.push_back(cmt); + delete cmtItem; } else { - RsGxsCommentItem* cmtItem = dynamic_cast(*vit); - if(cmtItem) + RsGxsVoteItem* votItem = + dynamic_cast(*vit); + if(votItem) { - RsGxsComment cmt; + RsGxsVote vot; RsGxsMsgItem *mi = (*vit); - cmt = cmtItem->mMsg; - cmt.mMeta = mi->meta; -#ifdef GXSCOMMENT_DEBUG - std::cerr << "p3Posted::getPostData Found Comment:" << std::endl; - cmt.print(std::cerr," ", "cmt"); -#endif - cmts.push_back(cmt); - delete cmtItem; + vot = votItem->mMsg; + vot.mMeta = mi->meta; + vots.push_back(vot); + delete votItem; } else { @@ -150,24 +170,37 @@ bool p3Posted::getPostData(const uint32_t &token, std::vector &msg //const uint16_t RS_SERVICE_GXS_TYPE_CHANNELS = 0x0217; //const uint8_t RS_PKT_SUBTYPE_GXSCHANNEL_POST_ITEM = 0x03; //const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_COMMENT_ITEM = 0xf1; - std::cerr << "Not a PostedPostItem neither a RsGxsCommentItem" - << " PacketService=" << std::hex << (int)msg->PacketService() << std::dec - << " PacketSubType=" << std::hex << (int)msg->PacketSubType() << std::dec - << " type name =" << typeid(*msg).name() - << " , deleting!" << std::endl; + //const uint8_t RS_PKT_SUBTYPE_GXSCOMMENT_VOTE_ITEM = 0xf2; + RsErr() << __PRETTY_FUNCTION__ + << "Not a PostedPostItem neither a " + << "RsGxsCommentItem neither a RsGxsVoteItem" + << " PacketService=" << std::hex << (int)msg->PacketService() << std::dec + << " PacketSubType=" << std::hex << (int)msg->PacketSubType() << std::dec + << " type name =" << typeid(*msg).name() + << " , deleting!" << std::endl; delete *vit; } } } } } - else - { - std::cerr << "p3GxsChannels::getPostData() ERROR in request"; - std::cerr << std::endl; - } - return ok; + return true; +} + +bool p3Posted::getPostData( + const uint32_t &token, std::vector &posts, std::vector &cmts) +{ + std::vector vots; + return getPostData( token, posts, cmts, vots); +} + +bool p3Posted::getPostData( + const uint32_t &token, std::vector &posts) +{ + std::vector cmts; + std::vector vots; + return getPostData( token, posts, cmts, vots); } //Not currently used @@ -323,23 +356,25 @@ bool p3Posted::getBoardsInfo( } bool p3Posted::getBoardAllContent( const RsGxsGroupId& groupId, - std::vector& posts, - std::vector& comments ) + std::vector& posts, + std::vector& comments, + std::vector& votes ) { uint32_t token; RsTokReqOptions opts; opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA; - if( !requestMsgInfo(token, opts, std::list({groupId})) || waitToken(token) != RsTokenService::COMPLETE ) - return false; + if( !requestMsgInfo(token, opts, std::list({groupId})) || waitToken(token) != RsTokenService::COMPLETE ) + return false; - return getPostData(token, posts, comments); + return getPostData(token, posts, comments, votes); } bool p3Posted::getBoardContent( const RsGxsGroupId& groupId, - const std::set& contentsIds, - std::vector& posts, - std::vector& comments ) + const std::set& contentsIds, + std::vector& posts, + std::vector& comments, + std::vector& votes ) { uint32_t token; RsTokReqOptions opts; @@ -351,7 +386,7 @@ bool p3Posted::getBoardContent( const RsGxsGroupId& groupId, if( !requestMsgInfo(token, opts, msgIds) || waitToken(token) != RsTokenService::COMPLETE ) return false; - return getPostData(token, posts, comments); + return getPostData(token, posts, comments, votes); } bool p3Posted::getBoardsSummaries(std::list& boards ) diff --git a/libretroshare/src/services/p3posted.h b/libretroshare/src/services/p3posted.h index b6f3ccee5..2fbc780bf 100644 --- a/libretroshare/src/services/p3posted.h +++ b/libretroshare/src/services/p3posted.h @@ -62,13 +62,15 @@ virtual void receiveHelperChanges(std::vector& changes) std::vector& groupsInfo ) override; bool getBoardAllContent(const RsGxsGroupId& groupId, - std::vector& posts, - std::vector& comments ) override; + std::vector& posts, + std::vector& comments, + std::vector& votes ) override; bool getBoardContent(const RsGxsGroupId& groupId, - const std::set& contentsIds, - std::vector& posts, - std::vector& comments ) override; + const std::set& contentsIds, + std::vector& posts, + std::vector& comments, + std::vector& votes ) override; bool getBoardsSummaries(std::list& groupInfo) override; @@ -80,9 +82,10 @@ virtual void receiveHelperChanges(std::vector& changes) bool createBoard(RsPostedGroup& board) override; - virtual bool getGroupData(const uint32_t &token, std::vector &groups); -virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts); -virtual bool getPostData(const uint32_t &token, std::vector &posts) { std::vector cmts; return getPostData( token, posts, cmts);} + virtual bool getGroupData(const uint32_t &token, std::vector &groups) override; + virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts, std::vector &vots) override; + virtual bool getPostData(const uint32_t &token, std::vector &posts, std::vector &cmts) override; + virtual bool getPostData(const uint32_t &token, std::vector &posts) override; //Not currently used //virtual bool getRelatedPosts(const uint32_t &token, std::vector &posts); diff --git a/retroshare-gui/src/gui/Posted/PostedItem.cpp b/retroshare-gui/src/gui/Posted/PostedItem.cpp index a8e7b0341..751f68ee5 100644 --- a/retroshare-gui/src/gui/Posted/PostedItem.cpp +++ b/retroshare-gui/src/gui/Posted/PostedItem.cpp @@ -167,8 +167,9 @@ void BasePostedItem::loadMessage() std::vector posts; std::vector comments; + std::vector votes; - if(! rsPosted->getBoardContent( groupId(), std::set( { messageId() } ),posts,comments)) + if(! rsPosted->getBoardContent( groupId(), std::set( { messageId() } ),posts,comments,votes)) { RsErr() << "BasePostedItem::loadMessage() ERROR getting data" << std::endl; mIsLoadingMessage = false; @@ -227,8 +228,9 @@ void BasePostedItem::loadComment() std::vector posts; std::vector comments; + std::vector votes; - if(! rsPosted->getBoardContent( groupId(),msgIds,posts,comments)) + if(! rsPosted->getBoardContent( groupId(),msgIds,posts,comments,votes)) { RsErr() << "BasePostedItem::loadGroup() ERROR getting data" << std::endl; mIsLoadingComment = false; diff --git a/retroshare-gui/src/gui/Posted/PostedListWidget.cpp b/retroshare-gui/src/gui/Posted/PostedListWidget.cpp index 53f97b7ad..92b322c8b 100644 --- a/retroshare-gui/src/gui/Posted/PostedListWidget.cpp +++ b/retroshare-gui/src/gui/Posted/PostedListWidget.cpp @@ -1033,8 +1033,9 @@ void PostedListWidget::getMsgData(const std::set& msgIds,std::ve { std::vector posts; std::vector comments; + std::vector votes; - rsPosted->getBoardContent( groupId(),msgIds,posts,comments ); + rsPosted->getBoardContent( groupId(),msgIds,posts,comments,votes ); psts.clear(); @@ -1046,8 +1047,9 @@ void PostedListWidget::getAllMsgData(std::vector& psts) { std::vector posts; std::vector comments; + std::vector votes; - rsPosted->getBoardAllContent( groupId(),posts,comments ); + rsPosted->getBoardAllContent( groupId(),posts,comments,votes ); psts.clear(); diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index 01c0b227b..25b93ac8d 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -319,8 +319,9 @@ void GxsChannelPostItem::loadMessage() std::vector posts; std::vector comments; + std::vector votes; - if(! rsGxsChannels->getChannelContent( groupId(), std::set( { messageId() } ),posts,comments)) + if(! rsGxsChannels->getChannelContent( groupId(), std::set( { messageId() } ),posts,comments,votes)) { RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl; return; diff --git a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp index 70edf9abf..56c910237 100644 --- a/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp +++ b/retroshare-gui/src/gui/gxschannels/CreateGxsChannelMsg.cpp @@ -738,14 +738,15 @@ void CreateGxsChannelMsg::loadOriginalChannelPostInfo() { std::vector posts; std::vector comments; + std::vector votes; - if( !rsGxsChannels->getChannelContent(mChannelId,std::set({mOrigPostId}),posts,comments) || posts.size() != 1) - { - std::cerr << "Cannot get channel post data for channel " << mChannelId << " and post " << mOrigPostId << std::endl; - return; - } + if( !rsGxsChannels->getChannelContent(mChannelId,std::set({mOrigPostId}),posts,comments,votes) || posts.size() != 1) + { + std::cerr << "Cannot get channel post data for channel " << mChannelId << " and post " << mOrigPostId << std::endl; + return; + } - RsQThreadUtils::postToObject( [posts,this]() + RsQThreadUtils::postToObject( [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 diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp index ff412f9ca..48b620775 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelPostsWidget.cpp @@ -694,7 +694,7 @@ void GxsChannelPostsWidget::insertChannelPosts(std::vector& po break; if (thread) - thread->emitAddPost(qVariantFromValue(*it), related, ++pos, count); + thread->emitAddPost(QVariant::fromValue(*it), related, ++pos, count); else createPostItem(*it, related); } @@ -812,8 +812,9 @@ void GxsChannelPostsWidget::getMsgData(const std::set& msgIds,st { std::vector posts; std::vector comments; + std::vector votes; - rsGxsChannels->getChannelContent( groupId(),msgIds,posts,comments ); + rsGxsChannels->getChannelContent( groupId(),msgIds,posts,comments,votes ); psts.clear(); @@ -825,8 +826,9 @@ void GxsChannelPostsWidget::getAllMsgData(std::vector& pst { std::vector posts; std::vector comments; + std::vector votes; - rsGxsChannels->getChannelAllContent( groupId(),posts,comments ); + rsGxsChannels->getChannelAllContent( groupId(),posts,comments,votes ); psts.clear();