added button in forums to flag poster identity as bad

This commit is contained in:
csoler 2015-10-09 18:51:16 -04:00
parent ce96e88925
commit 338fcee865
9 changed files with 50 additions and 11 deletions

View file

@ -680,8 +680,11 @@ void IdDialog::insertIdDetails(uint32_t token)
RsReputations::ReputationInfo info ;
rsReputations->getReputationInfo(RsGxsId(data.mMeta.mGroupId),info) ;
ui->overallOpinion_TF->setText(QString::number(info.mOverallReputationScore));
ui->neighborNodesOpinion_TF->setText(QString::number(info.mOverallReputationScore-1.0f));
ui->overallOpinion_TF->setText(QString::number(info.mOverallReputationScore-1.0f) +" ("+
((info.mAssessment == RsReputations::ASSESSMENT_OK)? tr("OK") : tr("Banned")) +")" ) ;
switch(info.mOwnOpinion)
{
case RsReputations::OPINION_NEGATIVE: ui->ownOpinion_CB->setCurrentIndex(0); break ;
@ -690,8 +693,6 @@ void IdDialog::insertIdDetails(uint32_t token)
default:
std::cerr << "Unexpected value in own opinion: " << info.mOwnOpinion << std::endl;
}
//ui->neighborNodesOpinion_TF->setText(QString::number(info.m));
}
void IdDialog::modifyReputation()
@ -740,11 +741,9 @@ void IdDialog::modifyReputation()
std::cerr << std::endl;
#endif
#ifdef SUSPENDED
// trigger refresh when finished.
// basic / anstype are not needed.
mIdQueue->queueRequest(token, 0, 0, IDDIALOG_REFRESH);
#endif
requestIdDetails();
return;
}

View file

@ -485,6 +485,9 @@
<layout class="QGridLayout" name="gridLayout_2">
<item row="2" column="1">
<widget class="QLineEdit" name="neighborNodesOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Average opinion of neighbor nodes about this identity. Negative is bad,&lt;/p&gt;&lt;p&gt;positive is good. Zero is neutral.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
@ -530,12 +533,16 @@ p, li { white-space: pre-wrap; }
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<item>
<property name="text">
<string>Negative</string>
</property>
<property name="icon">
<iconset>
<normaloff>../icons/yellow_biohazard64.png</normaloff>../icons/yellow_biohazard64.png</iconset>
</property>
</item>
<item>
<property name="text">
@ -551,6 +558,9 @@ p, li { white-space: pre-wrap; }
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="overallOpinion_TF">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Overall reputation score, accounting for yours and your friends'.&lt;/p&gt;&lt;p&gt;Negative is bad, positive is good. Zero is neutral. If the score is too low,&lt;/p&gt;&lt;p&gt;the identity is flagged as bad, and will be filtered out in forums, chat lobbies,&lt;/p&gt;&lt;p&gt;channels, etc.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="readOnly">
<bool>true</bool>
</property>

View file

@ -41,6 +41,7 @@
#include "util/QtVersion.h"
#include <retroshare/rsgxsforums.h>
#include <retroshare/rsreputations.h>
#include <retroshare/rspeers.h>
// These should be in retroshare/ folder.
#include "retroshare/rsgxsflags.h"
@ -57,6 +58,7 @@
#define IMAGE_DOWNLOAD ":/images/start.png"
#define IMAGE_DOWNLOADALL ":/images/startall.png"
#define IMAGE_COPYLINK ":/images/copyrslink.png"
#define IMAGE_BIOHAZARD ":/icons/yellow_biohazard64.png"
#define VIEW_LAST_POST 0
#define VIEW_THREADED 1
@ -406,6 +408,9 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
QAction *replyauthorAct = new QAction(QIcon(IMAGE_MESSAGEREPLY), tr("Reply with private message"), &contextMnu);
connect(replyauthorAct, SIGNAL(triggered()), this, SLOT(replytomessage()));
QAction *flagasbadAct = new QAction(QIcon(IMAGE_BIOHAZARD), tr("Flag this person as bad"), &contextMnu);
connect(flagasbadAct, SIGNAL(triggered()), this, SLOT(flagpersonasbad()));
QAction *newthreadAct = new QAction(QIcon(IMAGE_MESSAGE), tr("Start New Thread"), &contextMnu);
newthreadAct->setEnabled (IS_GROUP_SUBSCRIBED(mSubscribeFlags));
connect(newthreadAct , SIGNAL(triggered()), this, SLOT(createthread()));
@ -484,6 +489,8 @@ void GxsForumThreadWidget::threadListCustomPopupMenu(QPoint /*point*/)
contextMnu.addAction(expandAll);
contextMnu.addAction(collapseAll);
contextMnu.addSeparator();
contextMnu.addAction(flagasbadAct);
contextMnu.addSeparator();
contextMnu.addAction(replyauthorAct);
@ -1685,6 +1692,17 @@ static QString buildReplyHeader(const RsMsgMetaData &meta)
return header;
}
void GxsForumThreadWidget::flagpersonasbad()
{
if (groupId().isNull() || mThreadId.isNull()) {
QMessageBox::information(this, tr("RetroShare"),tr("You cant reply to a non-existant Message"));
return;
}
// Get Message ... then complete replyMessageData().
rsReputations->setOwnOpinion(RsGxsId(groupId()),RsReputations::OPINION_NEGATIVE) ;
}
void GxsForumThreadWidget::replytomessage()
{
if (groupId().isNull() || mThreadId.isNull()) {

View file

@ -101,6 +101,7 @@ private slots:
void downloadAllFiles();
void changedViewBox();
void flagpersonasbad();
void filterColumnChanged(int column);
void filterItems(const QString &text);
@ -170,7 +171,7 @@ private:
RsGxsMessageId mNavigatePendingMsgId;
QList<RsGxsMessageId> mIgnoredMsgId;
Ui::GxsForumThreadWidget *ui;
Ui::GxsForumThreadWidget *ui;
};
#endif // GXSFORUMTHREADWIDGET_H

View file

@ -60,5 +60,6 @@
<file>icons/user-busy_64.png</file>
<file>icons/user-offline_64.png</file>
<file>icons/user-online_64.png</file>
<file>icons/yellow_biohazard64.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB