mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-08 14:42:51 -04:00
fixed banning users from forum threads
This commit is contained in:
parent
f750818402
commit
e309dd6fed
3 changed files with 59 additions and 9 deletions
|
@ -177,6 +177,7 @@ public:
|
||||||
|
|
||||||
// reputation details.
|
// reputation details.
|
||||||
GxsReputation mReputation;
|
GxsReputation mReputation;
|
||||||
|
bool mBanned ;
|
||||||
|
|
||||||
// avatar
|
// avatar
|
||||||
RsGxsImage mAvatar ;
|
RsGxsImage mAvatar ;
|
||||||
|
|
|
@ -733,6 +733,9 @@ void GxsForumThreadWidget::insertGroupData()
|
||||||
case GXS_ID_DETAILS_TYPE_LOADING:
|
case GXS_ID_DETAILS_TYPE_LOADING:
|
||||||
author = GxsIdDetails::getLoadingText(details.mId);
|
author = GxsIdDetails::getLoadingText(details.mId);
|
||||||
break;
|
break;
|
||||||
|
case GXS_ID_DETAILS_TYPE_BANNED:
|
||||||
|
author = tr("[Banned]") ;
|
||||||
|
break ;
|
||||||
case GXS_ID_DETAILS_TYPE_DONE:
|
case GXS_ID_DETAILS_TYPE_DONE:
|
||||||
author = GxsIdDetails::getName(details);
|
author = GxsIdDetails::getName(details);
|
||||||
break;
|
break;
|
||||||
|
@ -1715,19 +1718,30 @@ static QString buildReplyHeader(const RsMsgMetaData &meta)
|
||||||
void GxsForumThreadWidget::flagpersonasbad()
|
void GxsForumThreadWidget::flagpersonasbad()
|
||||||
{
|
{
|
||||||
// no need to use the token system for that, since we just need to find out the author's name, which is in the item.
|
// no need to use the token system for that, since we just need to find out the author's name, which is in the item.
|
||||||
|
|
||||||
|
if (groupId().isNull() || mThreadId.isNull()) {
|
||||||
|
QMessageBox::information(this, tr("RetroShare"),tr("You cant reply to a non-existant Message"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QTreeWidgetItem *item = ui->threadTreeWidget->currentItem();
|
// Get Message ... then complete replyMessageData().
|
||||||
|
RsGxsGrpMsgIdPair postId = std::make_pair(groupId(), mThreadId);
|
||||||
|
|
||||||
|
RsTokReqOptions opts;
|
||||||
|
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||||
|
|
||||||
std::cerr << "Author string: \"" << item->data(COLUMN_THREAD_DATA, ROLE_THREAD_AUTHOR).toString().toStdString()<< std::endl;
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "Messagestring: \"" << item->data(COLUMN_THREAD_DATA, ROLE_THREAD_MSGID).toString().toStdString()<< std::endl;
|
std::cerr << "GxsForumThreadWidget::requestMsgData_BanAuthor(" << postId.first << "," << postId.second << ")";
|
||||||
std::cerr << "Messagestring: \"" << item->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toString().toStdString()<< std::endl;
|
std::cerr << std::endl;
|
||||||
RsGxsId gxsId(item->data(COLUMN_THREAD_DATA, ROLE_THREAD_AUTHOR).toString().toStdString());
|
#endif
|
||||||
|
|
||||||
// Get Message ... then complete replyMessageData().
|
GxsMsgReq msgIds;
|
||||||
std::cerr << "GxsForumThreadWidget::flagpersonasbad(): setting opinion for peer " << gxsId << " to " << RsReputations::OPINION_NEGATIVE << std::endl;
|
std::vector<RsGxsMessageId> &vect = msgIds[postId.first];
|
||||||
rsReputations->setOwnOpinion(gxsId,RsReputations::OPINION_NEGATIVE) ;
|
vect.push_back(postId.second);
|
||||||
|
|
||||||
|
uint32_t token;
|
||||||
|
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeBanAuthor);
|
||||||
|
|
||||||
emit groupChanged(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::replytomessage()
|
void GxsForumThreadWidget::replytomessage()
|
||||||
|
@ -2011,6 +2025,34 @@ void GxsForumThreadWidget::loadMsgData_ReplyMessage(const uint32_t &token)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxsForumThreadWidget::loadMsgData_BanAuthor(const uint32_t &token)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_FORUMS
|
||||||
|
std::cerr << "GxsForumThreadWidget::loadMsgData_BanAuthor()";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std::vector<RsGxsForumMsg> msgs;
|
||||||
|
if (rsGxsForums->getMsgData(token, msgs))
|
||||||
|
{
|
||||||
|
if (msgs.size() != 1)
|
||||||
|
{
|
||||||
|
std::cerr << "GxsForumThreadWidget::loadMsgData_ReplyMessage() ERROR Wrong number of answers";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::cerr << " banning author id " << msgs[0].mMeta.mAuthorId << std::endl;
|
||||||
|
rsReputations->setOwnOpinion(msgs[0].mMeta.mAuthorId,RsReputations::OPINION_NEGATIVE) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "GxsForumThreadWidget::loadMsgData_ReplyMessage() ERROR Missing Message Data...";
|
||||||
|
std::cerr << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit groupChanged(this) ;
|
||||||
|
}
|
||||||
/*********************** **** **** **** ***********************/
|
/*********************** **** **** **** ***********************/
|
||||||
/*********************** **** **** **** ***********************/
|
/*********************** **** **** **** ***********************/
|
||||||
|
|
||||||
|
@ -2038,6 +2080,11 @@ void GxsForumThreadWidget::loadRequest(const TokenQueue *queue, const TokenReque
|
||||||
loadMsgData_ReplyMessage(req.mToken);
|
loadMsgData_ReplyMessage(req.mToken);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (req.mUserType == mTokenTypeBanAuthor) {
|
||||||
|
loadMsgData_BanAuthor(req.mToken);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GxsMessageFrameWidget::loadRequest(queue, req);
|
GxsMessageFrameWidget::loadRequest(queue, req);
|
||||||
|
|
|
@ -141,6 +141,7 @@ private:
|
||||||
void loadMessageData(const uint32_t &token);
|
void loadMessageData(const uint32_t &token);
|
||||||
void requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &msgId);
|
void requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &msgId);
|
||||||
void loadMsgData_ReplyMessage(const uint32_t &token);
|
void loadMsgData_ReplyMessage(const uint32_t &token);
|
||||||
|
void loadMsgData_BanAuthor(const uint32_t &token);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RsGxsGroupId mLastForumID;
|
RsGxsGroupId mLastForumID;
|
||||||
|
@ -160,6 +161,7 @@ private:
|
||||||
uint32_t mTokenTypeInsertThreads;
|
uint32_t mTokenTypeInsertThreads;
|
||||||
uint32_t mTokenTypeMessageData;
|
uint32_t mTokenTypeMessageData;
|
||||||
uint32_t mTokenTypeReplyMessage;
|
uint32_t mTokenTypeReplyMessage;
|
||||||
|
uint32_t mTokenTypeBanAuthor;
|
||||||
|
|
||||||
/* Color definitions (for standard see qss.default) */
|
/* Color definitions (for standard see qss.default) */
|
||||||
QColor mTextColorRead;
|
QColor mTextColorRead;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue