fixed update of forum and circle lists when forum/circle is edited

This commit is contained in:
csoler 2020-12-06 21:29:56 +01:00
parent 4db0ed9fa9
commit 931be5dc6d
4 changed files with 31 additions and 2 deletions

View File

@ -240,6 +240,11 @@ enum class RsGxsCircleEventCode: uint8_t
* The circle has been deleted by auto-cleaning.
* */
CIRCLE_DELETED = 0x07,
/**
* Circle has been updated (name, parent circle, type, etc)
* */
CIRCLE_UPDATED = 0x08,
};
struct RsGxsCircleEvent: RsEvent

View File

@ -741,7 +741,18 @@ void p3GxsCircles::notifyChanges(std::vector<RsGxsNotify *> &changes)
rsEvents->postEvent(ev);
}
}
if( old_circle_grp_item->meta.mGroupName != new_circle_grp_item->meta.mGroupName
|| old_circle_grp_item->meta.mGroupFlags != new_circle_grp_item->meta.mGroupFlags
|| old_circle_grp_item->meta.mAuthorId != new_circle_grp_item->meta.mAuthorId
|| old_circle_grp_item->meta.mCircleId != new_circle_grp_item->meta.mCircleId
)
{
auto ev = std::make_shared<RsGxsCircleEvent>();
ev->mCircleId = RsGxsCircleId(new_circle_grp_item->meta.mGroupId);
ev->mCircleEventType = RsGxsCircleEventCode::CIRCLE_UPDATED;
rsEvents->postEvent(ev);
}
}
else if(c->getType()==RsGxsNotify::TYPE_GROUP_DELETED)
{
auto ev = std::make_shared<RsGxsCircleEvent>();

View File

@ -380,6 +380,18 @@ void p3GxsForums::notifyChanges(std::vector<RsGxsNotify *> &changes)
rsEvents->postEvent(ev);
}
if( old_forum_grp_item->mGroup.mDescription != new_forum_grp_item->mGroup.mDescription
|| old_forum_grp_item->meta.mGroupName != new_forum_grp_item->meta.mGroupName
|| old_forum_grp_item->meta.mGroupFlags != new_forum_grp_item->meta.mGroupFlags
|| old_forum_grp_item->meta.mAuthorId != new_forum_grp_item->meta.mAuthorId
|| old_forum_grp_item->meta.mCircleId != new_forum_grp_item->meta.mCircleId
)
{
auto ev = std::make_shared<RsGxsForumEvent>();
ev->mForumGroupId = new_forum_grp_item->meta.mGroupId;
ev->mForumEventCode = RsForumEventCode::UPDATED_FORUM;
rsEvents->postEvent(ev);
}
}
break;

View File

@ -66,7 +66,8 @@ void GxsForumsDialog::handleEvent_main_thread(std::shared_ptr<const RsEvent> eve
updateGroupStatisticsReal(e->mForumGroupId); // update the list immediately
break;
case RsForumEventCode::NEW_FORUM: // [[fallthrough]];
case RsForumEventCode::NEW_FORUM: // [[fallthrough]];
case RsForumEventCode::UPDATED_FORUM: // [[fallthrough]];
case RsForumEventCode::DELETED_FORUM: // [[fallthrough]];
case RsForumEventCode::SUBSCRIBE_STATUS_CHANGED:
updateDisplay(true);