added proper notifications when a group is deleted

This commit is contained in:
csoler 2020-11-25 23:35:20 +01:00
parent f21b57b643
commit bce514115d
15 changed files with 60 additions and 8 deletions

View File

@ -195,7 +195,7 @@ bool RsGxsCleanUp::clean(RsGxsGroupId& next_group_to_check)
} }
} }
//mDs->removeGroups(grps_to_delete); mDs->removeGroups(grps_to_delete);
return full_round; return full_round;
} }

View File

@ -118,6 +118,7 @@ enum class RsChannelEventCode: uint8_t
SYNC_PARAMETERS_UPDATED = 0x0a, // sync and storage times have changed SYNC_PARAMETERS_UPDATED = 0x0a, // sync and storage times have changed
NEW_COMMENT = 0x0b, // new comment arrived/published. mChannelThreadId gives the ID of the commented message NEW_COMMENT = 0x0b, // new comment arrived/published. mChannelThreadId gives the ID of the commented message
NEW_VOTE = 0x0c, // new vote arrived/published. mChannelThreadId gives the ID of the votes message comment NEW_VOTE = 0x0c, // new vote arrived/published. mChannelThreadId gives the ID of the votes message comment
DELETED_CHANNEL = 0x0d, // channel was deleted by auto-cleaning system
}; };
struct RsGxsChannelEvent: RsEvent struct RsGxsChannelEvent: RsEvent

View File

@ -235,6 +235,11 @@ enum class RsGxsCircleEventCode: uint8_t
* *
* no additional information. Simply means that the info previously from the cache has changed. */ * no additional information. Simply means that the info previously from the cache has changed. */
CACHE_DATA_UPDATED = 0x06, CACHE_DATA_UPDATED = 0x06,
/**
* The circle has been deleted by auto-cleaning.
* */
CIRCLE_DELETED = 0x07,
}; };
struct RsGxsCircleEvent: RsEvent struct RsGxsCircleEvent: RsEvent

View File

@ -117,6 +117,7 @@ enum class RsForumEventCode: uint8_t
MODERATOR_LIST_CHANGED = 0x08, /// forum moderation list has changed. MODERATOR_LIST_CHANGED = 0x08, /// forum moderation list has changed.
SYNC_PARAMETERS_UPDATED = 0x0a, /// sync and storage times have changed SYNC_PARAMETERS_UPDATED = 0x0a, /// sync and storage times have changed
PINNED_POSTS_CHANGED = 0x0b, /// some posts where pinned or un-pinned PINNED_POSTS_CHANGED = 0x0b, /// some posts where pinned or un-pinned
DELETED_FORUM = 0x0c, /// forum was deleted by cleaning
}; };
struct RsGxsForumEvent: RsEvent struct RsGxsForumEvent: RsEvent

View File

@ -119,6 +119,7 @@ enum class RsPostedEventCode: uint8_t
SYNC_PARAMETERS_UPDATED = 0x09, SYNC_PARAMETERS_UPDATED = 0x09,
NEW_COMMENT = 0x0a, NEW_COMMENT = 0x0a,
NEW_VOTE = 0x0b, NEW_VOTE = 0x0b,
BOARD_DELETED = 0x0c,
}; };

View File

@ -376,6 +376,15 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
} }
break; break;
case RsGxsNotify::TYPE_GROUP_DELETED:
{
auto ev = std::make_shared<RsGxsChannelEvent>();
ev->mChannelGroupId = grpChange->mGroupId;
ev->mChannelEventCode = RsChannelEventCode::DELETED_CHANNEL;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_RECEIVED_PUBLISHKEY: case RsGxsNotify::TYPE_RECEIVED_PUBLISHKEY:
{ {
/* group received */ /* group received */

View File

@ -698,7 +698,7 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mCircleId = RsGxsCircleId(*git); ev->mCircleId = RsGxsCircleId(*git);
ev->mGxsId = gxs_id; ev->mGxsId = gxs_id;
rsEvents->sendEvent(ev); rsEvents->postEvent(ev);
} }
} }
else if(c->getType()==RsGxsNotify::TYPE_UPDATED) else if(c->getType()==RsGxsNotify::TYPE_UPDATED)
@ -728,7 +728,7 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mCircleId = circle_id; ev->mCircleId = circle_id;
ev->mGxsId = gxs_id; ev->mGxsId = gxs_id;
rsEvents->sendEvent(ev); rsEvents->postEvent(ev);
} }
for(auto& gxs_id: old_circle_grp_item->gxsIdSet.ids) for(auto& gxs_id: old_circle_grp_item->gxsIdSet.ids)
@ -740,10 +740,19 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
ev->mCircleId = circle_id; ev->mCircleId = circle_id;
ev->mGxsId = gxs_id; ev->mGxsId = gxs_id;
rsEvents->sendEvent(ev); rsEvents->postEvent(ev);
} }
} }
else if(c->getType()==RsGxsNotify::TYPE_GROUP_DELETED)
{
auto ev = std::make_shared<RsGxsCircleEvent>();
ev->mCircleEventType = RsGxsCircleEventCode::CIRCLE_DELETED;
ev->mCircleId = RsGxsCircleId(groupChange->mGroupId);
rsEvents->postEvent(ev);
}
} }
} }

View File

@ -298,6 +298,15 @@ void p3GxsForums::notifyChanges(std::vector<RsGxsNotify *> &changes)
} }
break; break;
case RsGxsNotify::TYPE_GROUP_DELETED:
{
auto ev = std::make_shared<RsGxsForumEvent>();
ev->mForumGroupId = grpChange->mGroupId;
ev->mForumEventCode = RsForumEventCode::DELETED_FORUM;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_STATISTICS_CHANGED: case RsGxsNotify::TYPE_STATISTICS_CHANGED:
{ {
auto ev = std::make_shared<RsGxsForumEvent>(); auto ev = std::make_shared<RsGxsForumEvent>();

View File

@ -132,6 +132,7 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
} }
break; break;
case RsGxsNotify::TYPE_PROCESSED: case RsGxsNotify::TYPE_PROCESSED:
{ {
auto ev = std::make_shared<RsGxsPostedEvent>(); auto ev = std::make_shared<RsGxsPostedEvent>();
@ -184,6 +185,16 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
} }
break; break;
case RsGxsNotify::TYPE_GROUP_DELETED:
{
auto ev = std::make_shared<RsGxsPostedEvent>();
ev->mPostedGroupId = msgChange->mGroupId;
ev->mPostedEventCode = RsPostedEventCode::BOARD_DELETED;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_STATISTICS_CHANGED: case RsGxsNotify::TYPE_STATISTICS_CHANGED:
{ {
auto ev = std::make_shared<RsGxsPostedEvent>(); auto ev = std::make_shared<RsGxsPostedEvent>();

View File

@ -439,6 +439,7 @@ void IdDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE: case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_LEAVE:
case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_REMOVED_FROM_INVITEE_LIST: case RsGxsCircleEventCode::CIRCLE_MEMBERSHIP_ID_REMOVED_FROM_INVITEE_LIST:
case RsGxsCircleEventCode::NEW_CIRCLE: case RsGxsCircleEventCode::NEW_CIRCLE:
case RsGxsCircleEventCode::CIRCLE_DELETED:
case RsGxsCircleEventCode::CACHE_DATA_UPDATED: case RsGxsCircleEventCode::CACHE_DATA_UPDATED:
updateCircles(); updateCircles();

View File

@ -67,6 +67,7 @@ void PostedDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> event)
break; break;
case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]]; case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]];
case RsPostedEventCode::BOARD_DELETED: // [[fallthrough]];
case RsPostedEventCode::SUBSCRIBE_STATUS_CHANGED: // [[fallthrough]]; case RsPostedEventCode::SUBSCRIBE_STATUS_CHANGED: // [[fallthrough]];
updateDisplay(true); updateDisplay(true);
break; break;

View File

@ -493,6 +493,7 @@ void PostedListWidgetWithModel::handleEvent_main_thread(std::shared_ptr<const Rs
case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]]; case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]];
case RsPostedEventCode::UPDATED_POSTED_GROUP: // [[fallthrough]]; case RsPostedEventCode::UPDATED_POSTED_GROUP: // [[fallthrough]];
case RsPostedEventCode::UPDATED_MESSAGE: case RsPostedEventCode::UPDATED_MESSAGE:
case RsPostedEventCode::BOARD_DELETED:
case RsPostedEventCode::SYNC_PARAMETERS_UPDATED: case RsPostedEventCode::SYNC_PARAMETERS_UPDATED:
{ {
if(e->mPostedGroupId == groupId()) if(e->mPostedGroupId == groupId())

View File

@ -75,6 +75,7 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> ev
case RsChannelEventCode::RECEIVED_PUBLISH_KEY: // [[fallthrough]]; case RsChannelEventCode::RECEIVED_PUBLISH_KEY: // [[fallthrough]];
case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]]; case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]];
case RsChannelEventCode::DELETED_CHANNEL: // [[fallthrough]];
case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED:// reloads group summary (calling GxsGroupFrameDialog parent method) case RsChannelEventCode::SUBSCRIBE_STATUS_CHANGED:// reloads group summary (calling GxsGroupFrameDialog parent method)
updateDisplay(true); updateDisplay(true);
break; break;

View File

@ -750,6 +750,7 @@ void GxsChannelPostsWidgetWithModel::handleEvent_main_thread(std::shared_ptr<con
switch(e->mChannelEventCode) switch(e->mChannelEventCode)
{ {
case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]]; case RsChannelEventCode::NEW_CHANNEL: // [[fallthrough]];
case RsChannelEventCode::DELETED_CHANNEL: // [[fallthrough]];
case RsChannelEventCode::NEW_COMMENT: // [[fallthrough]]; case RsChannelEventCode::NEW_COMMENT: // [[fallthrough]];
case RsChannelEventCode::NEW_VOTE: // [[fallthrough]]; case RsChannelEventCode::NEW_VOTE: // [[fallthrough]];
case RsChannelEventCode::UPDATED_CHANNEL: // [[fallthrough]]; case RsChannelEventCode::UPDATED_CHANNEL: // [[fallthrough]];

View File

@ -67,6 +67,7 @@ void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> eve
break; break;
case RsForumEventCode::NEW_FORUM: // [[fallthrough]]; case RsForumEventCode::NEW_FORUM: // [[fallthrough]];
case RsForumEventCode::DELETED_FORUM: // [[fallthrough]];
case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED: case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED:
updateDisplay(true); updateDisplay(true);
break; break;