mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 08:54:13 -04:00
finished cleaning GxsCircle Notifications
This commit is contained in:
parent
26dd716967
commit
32baccae97
8 changed files with 160 additions and 172 deletions
|
@ -433,12 +433,11 @@ void IdDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
|
|||
|
||||
switch(e->mCircleEventType)
|
||||
{
|
||||
case RsGxsCircleEventCode::NEW_CIRCLE:
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST:
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_INVITE:
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_ADDED_TO_INVITEE_LIST:
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE:
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_JOIN:
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REVOKED:
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_REMOVED_FROM_INVITEE_LIST:
|
||||
case RsGxsCircleEventCode::NEW_CIRCLE:
|
||||
case RsGxsCircleEventCode::CACHE_DATA_UPDATED:
|
||||
|
||||
updateCircles();
|
||||
|
|
|
@ -309,10 +309,12 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
|
|||
return;
|
||||
}
|
||||
|
||||
// Check if the circle is one of which we belong to. If so, then notify in the GUI about other members leaving/subscribing
|
||||
if(!details.isGxsIdBased()) // not handled yet.
|
||||
return;
|
||||
|
||||
// Notications received depending on wether you got a membership request, if you
|
||||
// are admin of that circle, etc.
|
||||
// Check if the circle is one of which we belong to or we are an admin of.
|
||||
// If so, then notify in the GUI about other members leaving/subscribing, according
|
||||
// to the following rules. The names correspond to the RS_FEED_CIRCLE_* variables:
|
||||
//
|
||||
// Message-based notifications:
|
||||
//
|
||||
|
@ -321,57 +323,67 @@ void NewsFeed::handleCircleEvent(std::shared_ptr<const RsEvent> event)
|
|||
// +-------------+-------------+-------------+--------------+
|
||||
// | Admin | Not admin | Admin | Not admin |
|
||||
// +--------------------+-------------+-------------+----------------------------+
|
||||
// | in invitee list | 0x04 | 0x04 | 0x03 | 0x03 |
|
||||
// | in invitee list | MEMB_JOIN | MEMB_JOIN | MEMB_LEAVE | MEMB_LEAVE |
|
||||
// +--------------------+-------------+-------------+-------------+--------------+
|
||||
// |not in invitee list | 0x01 | X | X | X |
|
||||
// |not in invitee list | MEMB_REQ | X | X | X |
|
||||
// +--------------------+-------------+-------------+-------------+--------------+
|
||||
//
|
||||
// Note: in this case, the GxsId never belongs to you, since you dont need to handle
|
||||
// notifications for actions you took yourself (leave/join a circle)
|
||||
//
|
||||
// Group-based notifications, the GxsId belongs to you:
|
||||
// GroupData-based notifications, the GxsId belongs to you:
|
||||
//
|
||||
// +---------------------------+----------------------------+
|
||||
// | GxsId joins invitee list | GxsId leaves invitee list |
|
||||
// +-------------+-------------+-------------+--------------+
|
||||
// | Id is yours| Id is not | Id is yours | Id is not |
|
||||
// +--------------------+-------------+-------------+-------------+--------------+
|
||||
// | Has Member request | 0x06 | 0x04 | 0x05 | 0x03 |
|
||||
// | Has Member request | MEMB_ACCEPT | (MEMB_JOIN) | MEMB_REVOKED| (MEMB_LEAVE) |
|
||||
// +--------------------+-------------+-------------+-------------+--------------+
|
||||
// | No Member request | 0x02 | X | 0x05 | X |
|
||||
// | No Member request | INVITE_REC | X | INVITE_REM | X |
|
||||
// +--------------------+-------------+-------------+-------------+--------------+
|
||||
//
|
||||
// Note: In this case you're never an admin of the circle, since these notification
|
||||
// would be a direct consequence of your own actions.
|
||||
|
||||
if(details.mAmIAllowed || details.mAmIAdmin)
|
||||
switch(pe->mCircleEventType)
|
||||
{
|
||||
switch(pe->mCircleEventType)
|
||||
{
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST:
|
||||
// only show membership requests if we're an admin of that circle
|
||||
if(details.mAmIAdmin)
|
||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_REQ),true);
|
||||
break;
|
||||
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_JOIN:
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REQUEST:
|
||||
// only show membership requests if we're an admin of that circle
|
||||
if(details.isIdInInviteeList(pe->mGxsId))
|
||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_JOIN),true);
|
||||
break;
|
||||
else if(details.mAmIAdmin)
|
||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_REQ),true);
|
||||
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE:
|
||||
break;
|
||||
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE:
|
||||
|
||||
if(details.isIdInInviteeList(pe->mGxsId))
|
||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_LEAVE),true);
|
||||
break;
|
||||
break;
|
||||
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_INVITE:
|
||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_INVIT_REC),true);
|
||||
break;
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_ADDED_TO_INVITEE_LIST:
|
||||
if(rsIdentity->isOwnId(pe->mGxsId))
|
||||
{
|
||||
if(details.isIdRequestingMembership(pe->mGxsId))
|
||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED),true);
|
||||
else
|
||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_INVITE_REC),true);
|
||||
}
|
||||
break;
|
||||
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_REVOKED:
|
||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_REVOKED),true);
|
||||
break;
|
||||
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_REMOVED_FROM_INVITEE_LIST:
|
||||
if(rsIdentity->isOwnId(pe->mGxsId))
|
||||
{
|
||||
if(details.isIdRequestingMembership(pe->mGxsId))
|
||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_MEMB_REVOKED),true);
|
||||
else
|
||||
addFeedItemIfUnique(new GxsCircleItem(this, NEWSFEED_CIRCLELIST, pe->mCircleId, pe->mGxsId, RS_FEED_ITEM_CIRCLE_INVITE_CANCELLED),true);
|
||||
}
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -287,9 +287,11 @@ void PeopleDialog::insertCircles(uint32_t token)
|
|||
continue ;
|
||||
}//if(!rsGxsCircles->getCircleDetails(RsGxsCircleId(git->mGroupId), details))
|
||||
|
||||
if (details.mCircleType != GXS_CIRCLE_TYPE_EXTERNAL){
|
||||
if (details.mCircleType != RsGxsCircleType::EXTERNAL)
|
||||
{
|
||||
std::map<RsGxsGroupId, CircleWidget*>::iterator itFound;
|
||||
if((itFound=_int_circles_widgets.find(gsItem.mGroupId)) == _int_circles_widgets.end()) {
|
||||
if((itFound=_int_circles_widgets.find(gsItem.mGroupId)) == _int_circles_widgets.end())
|
||||
{
|
||||
std::cerr << "PeopleDialog::insertExtCircles() add new Internal GroupId: " << gsItem.mGroupId;
|
||||
std::cerr << " GroupName: " << gsItem.mGroupName;
|
||||
std::cerr << std::endl;
|
||||
|
@ -307,7 +309,9 @@ void PeopleDialog::insertCircles(uint32_t token)
|
|||
QPixmap pixmap = gitem->getImage();
|
||||
pictureFlowWidgetInternal->addSlide( pixmap );
|
||||
_intListCir << gitem;
|
||||
} else {//if((itFound=_int_circles_widgets.find(gsItem.mGroupId)) == _int_circles_widgets.end())
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PeopleDialog::insertExtCircles() Update GroupId: " << gsItem.mGroupId;
|
||||
std::cerr << " GroupName: " << gsItem.mGroupName;
|
||||
std::cerr << std::endl;
|
||||
|
@ -318,8 +322,10 @@ void PeopleDialog::insertCircles(uint32_t token)
|
|||
//int index = _intListCir.indexOf(cirWidget);
|
||||
//QPixmap pixmap = cirWidget->getImage();
|
||||
//pictureFlowWidgetInternal->setSlide(index, pixmap);
|
||||
}//if((item=_int_circles_widgets.find(gsItem.mGroupId)) == _int_circles_widgets.end())
|
||||
} else {//if (!details.mIsExternal)
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::map<RsGxsGroupId, CircleWidget*>::iterator itFound;
|
||||
if((itFound=_ext_circles_widgets.find(gsItem.mGroupId)) == _ext_circles_widgets.end()) {
|
||||
std::cerr << "PeopleDialog::insertExtCircles() add new GroupId: " << gsItem.mGroupId;
|
||||
|
@ -339,7 +345,9 @@ void PeopleDialog::insertCircles(uint32_t token)
|
|||
QPixmap pixmap = gitem->getImage();
|
||||
pictureFlowWidgetExternal->addSlide( pixmap );
|
||||
_extListCir << gitem;
|
||||
} else {//if((itFound=_circles_widgets.find(gsItem.mGroupId)) == _circles_widgets.end())
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PeopleDialog::insertExtCircles() Update GroupId: " << gsItem.mGroupId;
|
||||
std::cerr << " GroupName: " << gsItem.mGroupName;
|
||||
std::cerr << std::endl;
|
||||
|
@ -350,9 +358,9 @@ void PeopleDialog::insertCircles(uint32_t token)
|
|||
//int index = _extListCir.indexOf(cirWidget);
|
||||
//QPixmap pixmap = cirWidget->getImage();
|
||||
//pictureFlowWidgetExternal->setSlide(index, pixmap);
|
||||
}//if((item=_circles_items.find(gsItem.mGroupId)) == _circles_items.end())
|
||||
}//else (!details.mIsExternal)
|
||||
}//for(gsIt = gSummaryList.begin(); gsIt != gSummaryList.end(); ++gsIt)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PeopleDialog::requestIdList()
|
||||
|
|
|
@ -77,34 +77,31 @@ void GxsCircleItem::setup()
|
|||
|
||||
/* update circle information */
|
||||
|
||||
ui->acceptButton->setToolTip(tr("Grant membership request"));
|
||||
ui->revokeButton->setToolTip(tr("Revoke membership request"));
|
||||
|
||||
connect(ui->acceptButton, SIGNAL(clicked()), this, SLOT(grantCircleMembership()));
|
||||
connect(ui->revokeButton, SIGNAL(clicked()), this, SLOT(revokeCircleMembership()));
|
||||
|
||||
RsGxsCircleDetails circleDetails;
|
||||
if (rsGxsCircles->getCircleDetails(mCircleId, circleDetails))
|
||||
{
|
||||
// from here we can figure out if we already have requested membership or not
|
||||
|
||||
if (mType == RS_FEED_ITEM_CIRCLE_MEMB_REQ)
|
||||
{
|
||||
ui->titleLabel->setText(tr("You received a membership request for circle:"));
|
||||
ui->titleLabel->setText(tr("You received a membership request a circle you're administrating:"));
|
||||
ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str()));
|
||||
ui->gxsIdLabel->setText(idName);
|
||||
ui->iconLabel->setPixmap(pixmap);
|
||||
ui->gxsIdLabel->setId(mGxsId);
|
||||
|
||||
if(circleDetails.mAmIAdmin)
|
||||
{
|
||||
ui->acceptButton->setToolTip(tr("Grant membership request"));
|
||||
ui->revokeButton->setToolTip(tr("Revoke membership request"));
|
||||
connect(ui->acceptButton, SIGNAL(clicked()), this, SLOT(grantCircleMembership()));
|
||||
connect(ui->revokeButton, SIGNAL(clicked()), this, SLOT(revokeCircleMembership()));
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->acceptButton->setEnabled(false);
|
||||
ui->revokeButton->setEnabled(false);
|
||||
}
|
||||
ui->revokeButton->setHidden(true);
|
||||
ui->acceptButton->setHidden(false);
|
||||
}
|
||||
else if (mType == RS_FEED_ITEM_CIRCLE_INVIT_REC)
|
||||
else if (mType == RS_FEED_ITEM_CIRCLE_INVITE_REC)
|
||||
{
|
||||
ui->titleLabel->setText(tr("You received an invitation for circle:"));
|
||||
ui->titleLabel->setText(tr("You received an invitation for this circle:"));
|
||||
ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str()));
|
||||
ui->gxsIdLabel->setText(idName);
|
||||
ui->iconLabel->setPixmap(pixmap);
|
||||
|
@ -116,7 +113,7 @@ void GxsCircleItem::setup()
|
|||
}
|
||||
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_LEAVE)
|
||||
{
|
||||
ui->titleLabel->setText(idName + tr(" has left this circle you belong to."));
|
||||
ui->titleLabel->setText(idName + tr(" has left this circle."));
|
||||
ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str()));
|
||||
ui->gxsIdLabel->setText(idName);
|
||||
ui->iconLabel->setPixmap(pixmap);
|
||||
|
@ -127,21 +124,18 @@ void GxsCircleItem::setup()
|
|||
}
|
||||
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_JOIN)
|
||||
{
|
||||
ui->titleLabel->setText(idName + tr(" has join this circle you also belong to."));
|
||||
ui->titleLabel->setText(idName + tr(" which you invited, has join this circle you're administrating."));
|
||||
ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str()));
|
||||
ui->gxsIdLabel->setText(idName);
|
||||
ui->iconLabel->setPixmap(pixmap);
|
||||
ui->gxsIdLabel->setId(mGxsId);
|
||||
|
||||
ui->acceptButton->setHidden(true);
|
||||
ui->revokeButton->setHidden(true);
|
||||
ui->revokeButton->setHidden(false);
|
||||
}
|
||||
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_REVOKED)
|
||||
{
|
||||
if(rsIdentity->isOwnId(mGxsId))
|
||||
ui->titleLabel->setText(tr("Your identity %1 has been revoqued from this circle.").arg(idName));
|
||||
else
|
||||
ui->titleLabel->setText(tr("Identity %1 has been revoqued from this circle you belong to.").arg(idName));
|
||||
ui->titleLabel->setText(tr("Your identity %1 has been revoked from this circle.").arg(idName));
|
||||
|
||||
ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str()));
|
||||
ui->gxsIdLabel->setText(idName);
|
||||
|
@ -151,6 +145,19 @@ void GxsCircleItem::setup()
|
|||
ui->acceptButton->setHidden(true);
|
||||
ui->revokeButton->setHidden(true);
|
||||
}
|
||||
else if (mType == RS_FEED_ITEM_CIRCLE_MEMB_ACCEPTED)
|
||||
{
|
||||
ui->titleLabel->setText(tr("Your identity %1 as been accepted in this circle.").arg(idName));
|
||||
|
||||
ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str()));
|
||||
ui->gxsIdLabel->setText(idName);
|
||||
ui->iconLabel->setPixmap(pixmap);
|
||||
ui->gxsIdLabel->setId(mGxsId);
|
||||
|
||||
ui->acceptButton->setHidden(true);
|
||||
ui->revokeButton->setHidden(true);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue