aboutsummaryrefslogtreecommitdiff
path: root/lib/events/encryptedevent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/events/encryptedevent.cpp')
-rw-r--r--lib/events/encryptedevent.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/events/encryptedevent.cpp b/lib/events/encryptedevent.cpp
index 3af3d6ff..ec00ad4c 100644
--- a/lib/events/encryptedevent.cpp
+++ b/lib/events/encryptedevent.cpp
@@ -49,14 +49,16 @@ RoomEventPtr EncryptedEvent::createDecrypted(const QString &decrypted) const
eventObject["event_id"] = id();
eventObject["sender"] = senderId();
eventObject["origin_server_ts"] = originTimestamp().toMSecsSinceEpoch();
- if (const auto relatesToJson = contentPart("m.relates_to"_ls); !relatesToJson.isUndefined()) {
+ if (const auto relatesToJson = contentPart<QJsonObject>("m.relates_to"_ls);
+ !relatesToJson.isEmpty()) {
auto content = eventObject["content"].toObject();
- content["m.relates_to"] = relatesToJson.toObject();
+ content["m.relates_to"] = relatesToJson;
eventObject["content"] = content;
}
- if (const auto redactsJson = unsignedPart("redacts"_ls); !redactsJson.isUndefined()) {
+ if (const auto redactsJson = unsignedPart<QString>("redacts"_ls);
+ !redactsJson.isEmpty()) {
auto unsign = eventObject["unsigned"].toObject();
- unsign["redacts"] = redactsJson.toString();
+ unsign["redacts"] = redactsJson;
eventObject["unsigned"] = unsign;
}
return loadEvent<RoomEvent>(eventObject);
@@ -64,7 +66,7 @@ RoomEventPtr EncryptedEvent::createDecrypted(const QString &decrypted) const
void EncryptedEvent::setRelation(const QJsonObject& relation)
{
- auto content = editJson()["content"_ls].toObject();
+ auto content = contentJson();
content["m.relates_to"] = relation;
editJson()["content"] = content;
}