mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-23 13:15:51 -04:00
Workaround JSON API opacity of RsTlv*Set in RsGxsForumGroup
JSON API user would bet an unusable base64 blob due to RsTlv opaque JSON serialization, this way the content of the set is serialized plainly so it is usable through JSON API, without breaking binary serialization compatibility. We must stop using those RsTlv derived items.
This commit is contained in:
parent
933a6f1133
commit
cc8300a098
2 changed files with 36 additions and 14 deletions
|
@ -813,3 +813,34 @@ void p3GxsForums::handle_event(uint32_t event_type, const std::string &/*elabel*
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RsGxsForumGroup::serial_process(
|
||||
RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx )
|
||||
{
|
||||
RS_SERIAL_PROCESS(mMeta);
|
||||
RS_SERIAL_PROCESS(mDescription);
|
||||
|
||||
/* Work around to have usable JSON API, without breaking binary
|
||||
* serialization retrocompatibility */
|
||||
switch (j)
|
||||
{
|
||||
case RsGenericSerializer::TO_JSON: // fallthrough
|
||||
case RsGenericSerializer::FROM_JSON:
|
||||
RsTypeSerializer::serial_process( j, ctx,
|
||||
mAdminList.ids, "mAdminList" );
|
||||
RsTypeSerializer::serial_process( j, ctx,
|
||||
mPinnedPosts.ids, "mPinnedPosts" );
|
||||
break;
|
||||
default:
|
||||
RS_SERIAL_PROCESS(mAdminList);
|
||||
RS_SERIAL_PROCESS(mPinnedPosts);
|
||||
}
|
||||
}
|
||||
|
||||
bool RsGxsForumGroup::canEditPosts(const RsGxsId& id) const
|
||||
{
|
||||
return mAdminList.ids.find(id) != mAdminList.ids.end() ||
|
||||
id == mMeta.mAuthorId;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue