made RsReputation::overallReputationLevel() to also return the identity ownership flags so that we dont need to rely on async calls to p3IdService to get them

This commit is contained in:
csoler 2017-02-06 23:46:01 +01:00
parent 013eb93f70
commit 6a9b697e42
6 changed files with 46 additions and 15 deletions

View file

@ -1110,18 +1110,12 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
// Early check for a message that should be hidden because its author
// is flagged with a bad reputation
RsIdentityDetails iddetails;
RsReputations::ReputationLevel reputation_level = RsReputations::REPUTATION_NEUTRAL;
uint32_t idflags =0;
RsReputations::ReputationLevel reputation_level = rsReputations->overallReputationLevel(msg.mMeta.mAuthorId,&idflags) ;
bool redacted = false;
if( rsIdentity->getIdDetails(msg.mMeta.mAuthorId,iddetails) )
{
reputation_level = iddetails.mReputation.mOverallReputationLevel;
redacted = (reputation_level == RsReputations::REPUTATION_LOCALLY_NEGATIVE);
}
else
reputation_level = RsReputations::REPUTATION_UNKNOWN;
redacted = (reputation_level == RsReputations::REPUTATION_LOCALLY_NEGATIVE);
GxsIdRSTreeWidgetItem *item = new GxsIdRSTreeWidgetItem(mThreadCompareRole,GxsIdDetails::ICON_TYPE_AVATAR );
item->moveToThread(ui->threadTreeWidget->thread());
@ -1144,7 +1138,7 @@ QTreeWidgetItem *GxsForumThreadWidget::convertMsgToThreadWidget(const RsGxsForum
rep_warning_level = 2 ;
rep_tooltip_str = tr("You have banned this ID. The message will not be\ndisplayed nor forwarded to your friends.") ;
}
else if(reputation_level < rsGxsForums->minReputationForForwardingMessages(mForumGroup.mMeta.mSignFlags,iddetails.mFlags))
else if(reputation_level < rsGxsForums->minReputationForForwardingMessages(mForumGroup.mMeta.mSignFlags,idflags))
{
rep_warning_level = 1 ;
rep_tooltip_str = tr("You have not set an opinion for this person,\n and your friends do not vote positively: Spam regulation \nprevents the message to be forwarded to your friends.") ;

View file

@ -31,7 +31,7 @@
#include <iostream>
#include <algorithm>
#define DEBUG_FORUMS
//#define DEBUG_FORUMS
#define PROGRESSBAR_MAX 100
@ -158,7 +158,9 @@ void GxsForumsFillThread::run()
for(uint32_t i=0;i<msgs_array.size();++i)
{
#ifdef DEBUG_FORUMS
std::cerr << "Adding message " << msgs_array[i].mMeta.mMsgId << " with parent " << msgs_array[i].mMeta.mParentId << " to message map" << std::endl;
#endif
msgs[msgs_array[i].mMeta.mMsgId] = msgs_array[i] ;
}
}