libQuotient icon indicating copy to clipboard operation
libQuotient copied to clipboard

Add toJson() for events and get rid of CreateRoomJob::StateEvent

Open KitsuneRal opened this issue 11 months ago • 0 comments

With all event classes ultimately being mere wrappers around QJsonObject, there's no particular reason we shouldn't enable their serialisation by simply calling Event::fullJson(). There used to be Event::toJson() before but it was deemed confusing as usually it was Event::contentJson() (that didn't exist back then) actually needed. That being said, we now have (automatically generated but no less superfluous) CreateRoomJob::StateEvent that duplicates StateEvent in terms of structure, except that it actually keeps the type, the state key, and the content separate. It can be argued whether this model might be better for all events (eliminating the need for Event::editJson() kludge?) but it certainly is duplication serving no good purpose.

KitsuneRal avatar Apr 04 '24 06:04 KitsuneRal