mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-22 06:09:09 -04:00
fixed voting in Boards
This commit is contained in:
parent
347b3ac9aa
commit
20346fc30e
4 changed files with 42 additions and 9 deletions
|
@ -442,9 +442,41 @@ bool p3Posted::createBoard(RsPostedGroup& board)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool p3Posted::voteForPost(bool up,const RsGxsGroupId& postGrpId,const RsGxsMessageId& postMsgId,const RsGxsId& voterId)
|
||||
bool p3Posted::voteForPost(bool up,const RsGxsGroupId& postGrpId,const RsGxsMessageId& postMsgId,const RsGxsId& authorId)
|
||||
{
|
||||
std::cerr << "(EE) " << __PRETTY_FUNCTION__ << ": Not implemented yet"<< std::endl;
|
||||
// Do some basic tests
|
||||
|
||||
if(!rsIdentity->isOwnId(authorId)) // This is ruled out before waitToken complains. Not sure it's needed.
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << ": vote submitted with an ID that is not yours! This cannot work." << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
RsGxsVote vote;
|
||||
|
||||
vote.mMeta.mGroupId = postGrpId;
|
||||
vote.mMeta.mThreadId = postMsgId;
|
||||
vote.mMeta.mParentId = postMsgId;
|
||||
vote.mMeta.mAuthorId = authorId;
|
||||
|
||||
if (up)
|
||||
vote.mVoteType = GXS_VOTE_UP;
|
||||
else
|
||||
vote.mVoteType = GXS_VOTE_DOWN;
|
||||
|
||||
uint32_t token;
|
||||
|
||||
if(!createNewVote(token, vote))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error! Failed submitting vote to (group,msg) " << postGrpId << "," << postMsgId << " from author " << authorId << std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(waitToken(token) != RsTokenService::COMPLETE)
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " Error! GXS operation failed." << std::endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -128,17 +128,17 @@ virtual void setMessageReadStatus(uint32_t& token, const RsGxsGrpMsgIdPair& msgI
|
|||
return mCommentService->createGxsComment(token, msg) && waitToken(token) == RsTokenService::COMPLETE ;
|
||||
}
|
||||
|
||||
virtual bool createNewVote(uint32_t &token, RsGxsVote &msg)
|
||||
virtual bool createNewVote(uint32_t &token, RsGxsVote &msg) override
|
||||
{
|
||||
return mCommentService->createGxsVote(token, msg);
|
||||
}
|
||||
|
||||
virtual bool acknowledgeComment(
|
||||
uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId )
|
||||
uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId ) override
|
||||
{ return acknowledgeMsg(token, msgId); }
|
||||
|
||||
virtual bool acknowledgeVote(
|
||||
uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId )
|
||||
uint32_t token, std::pair<RsGxsGroupId, RsGxsMessageId>& msgId ) override
|
||||
{
|
||||
if (mCommentService->acknowledgeVote(token, msgId)) return true;
|
||||
return acknowledgeMsg(token, msgId);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue