aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-11-03 09:03:05 +0100
committerGitHub <noreply@github.com>2021-11-03 09:03:05 +0100
commit316069f3c342b64598a40d9d7fd6e015ec0c91dd (patch)
treebb5e60d80584fd4ce41ddda964bd9b02c90ce1f5
parent9ee0efbf1d7a431c370b13e1d49c903165d474fe (diff)
parentfe77279cf0f7de006db40a828cc2fb7261e8e0bd (diff)
downloadlibquotient-316069f3c342b64598a40d9d7fd6e015ec0c91dd.tar.gz
libquotient-316069f3c342b64598a40d9d7fd6e015ec0c91dd.zip
Merge pull request #513 from TobiasFella/editedreplies
Keep the reply when replacing an event
-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();