Fix m.relates_to being sent as 'null' when not set in encrypted messages.

Thank you Sorunome for reporting.
This commit is contained in:
Nicolas Werner 2020-06-20 19:26:54 +02:00
parent cded494cb5
commit c973fd759b

View file

@ -168,7 +168,8 @@ encrypt_group_message(const std::string &room_id, const std::string &device_id,
// relations shouldn't be encrypted... // relations shouldn't be encrypted...
mtx::common::ReplyRelatesTo relation; mtx::common::ReplyRelatesTo relation;
if (body["content"]["m.relates_to"].contains("m.in_reply_to")) { if (body["content"].contains("m.relates_to") &&
body["content"]["m.relates_to"].contains("m.in_reply_to")) {
relation = body["content"]["m.relates_to"]; relation = body["content"]["m.relates_to"];
body["content"].erase("m.relates_to"); body["content"].erase("m.relates_to");
} }