mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-30 01:38:51 -04:00
added NewsFeed item for advertising about new/removed moderators
This commit is contained in:
parent
f7199f1f1c
commit
89843a6cbe
5 changed files with 111 additions and 12 deletions
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include "GxsForumGroupItem.h"
|
||||
#include "ui_GxsForumGroupItem.h"
|
||||
#include "gui/NewsFeed.h"
|
||||
|
||||
#include "FeedHolder.h"
|
||||
#include "gui/RetroShareLink.h"
|
||||
|
@ -37,6 +38,16 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co
|
|||
requestGroup();
|
||||
}
|
||||
|
||||
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate):
|
||||
GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsForums, autoUpdate),
|
||||
mAddedModerators(added_moderators),
|
||||
mRemovedModerators(removed_moderators)
|
||||
{
|
||||
setup();
|
||||
|
||||
requestGroup();
|
||||
}
|
||||
|
||||
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate) :
|
||||
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsForums, autoUpdate)
|
||||
{
|
||||
|
@ -158,10 +169,59 @@ void GxsForumGroupItem::fill()
|
|||
ui->subscribeButton->setEnabled(true);
|
||||
}
|
||||
|
||||
// if (mIsNew)
|
||||
// {
|
||||
if(feedId() == NEWSFEED_UPDATED_FORUM)
|
||||
{
|
||||
if(!mAddedModerators.empty() || !mRemovedModerators.empty())
|
||||
{
|
||||
ui->titleLabel->setText(tr("Moderator list changed"));
|
||||
ui->moderatorList_GB->show();
|
||||
|
||||
QString msg;
|
||||
|
||||
if(!mAddedModerators.empty())
|
||||
{
|
||||
msg += "<b>Added moderators:</b>" ;
|
||||
msg += "<p>";
|
||||
for(auto& gxsid: mAddedModerators)
|
||||
{
|
||||
RsIdentityDetails det;
|
||||
if(rsIdentity->getIdDetails(gxsid,det))
|
||||
msg += QString::fromUtf8(det.mNickname.c_str())+" ("+QString::fromStdString(gxsid.toStdString())+"), ";
|
||||
else
|
||||
msg += QString("[Unknown name]") + " ("+QString::fromStdString(gxsid.toStdString())+"), ";
|
||||
}
|
||||
msg.resize(msg.size()-2);
|
||||
msg += "</p>";
|
||||
}
|
||||
if(!mRemovedModerators.empty())
|
||||
{
|
||||
msg += "<b>Removed moderators:</b>" ;
|
||||
msg += "<p>";
|
||||
for(auto& gxsid: mRemovedModerators)
|
||||
{
|
||||
RsIdentityDetails det;
|
||||
|
||||
if( rsIdentity->getIdDetails(gxsid,det))
|
||||
msg += QString::fromUtf8(det.mNickname.c_str())+" ("+QString::fromStdString(gxsid.toStdString())+"), ";
|
||||
else
|
||||
msg += QString("[Unknown name]") + " ("+QString::fromStdString(gxsid.toStdString())+"), ";
|
||||
}
|
||||
msg.resize(msg.size()-2);
|
||||
msg += "</p>";
|
||||
}
|
||||
ui->moderatorList_TE->setText(msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->moderatorList_GB->hide();
|
||||
|
||||
ui->titleLabel->setText(tr("Forum updated"));
|
||||
ui->moderatorList_GB->hide();
|
||||
}
|
||||
}
|
||||
else
|
||||
ui->titleLabel->setText(tr("New Forum"));
|
||||
// }
|
||||
|
||||
// else
|
||||
// {
|
||||
// ui->titleLabel->setText(tr("Updated Forum"));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue