aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/room.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/room.cpp b/lib/room.cpp
index a923bf9a..e1d41fc3 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -2251,8 +2251,13 @@ bool Room::Private::processRedaction(const RedactionEvent& redaction)
RoomEventPtr makeReplaced(const RoomEvent& target,
const RoomMessageEvent& replacement)
{
+ const auto &targetReply = target.contentJson()["m.relates_to"].toObject();
+ auto newContent = replacement.contentJson().value("m.new_content"_ls).toObject();
+ if (!targetReply.empty()) {
+ newContent["m.relates_to"] = targetReply;
+ }
auto originalJson = target.originalJsonObject();
- originalJson[ContentKeyL] = replacement.contentJson().value("m.new_content"_ls);
+ originalJson[ContentKeyL] = newContent;
auto unsignedData = originalJson.take(UnsignedKeyL).toObject();
auto relations = unsignedData.take("m.relations"_ls).toObject();