summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-02-18 01:33:10 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-02-18 01:33:10 +0100
commit05727b8a45d9aee2b563bf500b49aa991b338486 (patch)
tree6f7ce05eebfe8029ac4d74cb49e006316b8adf56 /src
parentMerge pull request #1376 from xvitaly/blurhash (diff)
downloadnheko-05727b8a45d9aee2b563bf500b49aa991b338486.tar.xz
Fix edits in other clients jumping out of threads
fixes #1373
Diffstat (limited to '')
-rw-r--r--src/timeline/EventStore.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp
index 66eed82f..2cd16be8 100644
--- a/src/timeline/EventStore.cpp
+++ b/src/timeline/EventStore.cpp
@@ -534,11 +534,15 @@ EventStore::edits(const std::string &event_id)
         if (edit_rel.replaces() == event_id &&
             original_sender == mtx::accessors::sender(*related_event)) {
             auto related_ev = *related_event;
-            if (edit_rel.synthesized && original_relations.reply_to() && !edit_rel.reply_to()) {
-                auto edit_rel_copy = edit_rel;
-                edit_rel_copy.relations.push_back(
-                  {mtx::common::RelationType::InReplyTo, original_relations.reply_to().value()});
-                mtx::accessors::set_relations(related_ev, std::move(edit_rel_copy));
+
+            // spec does not allow changing relatings in an edit. So if we are not using the multi
+            // relation format specific to Nheko, just use the original relations + the edit...
+            if (edit_rel.synthesized) {
+                auto merged_relations = original_relations;
+                merged_relations.synthesized = true;
+                merged_relations.relations.push_back(
+                  {mtx::common::RelationType::Replace, event_id});
+                mtx::accessors::set_relations(related_ev, std::move(merged_relations));
             }
             edits.push_back(std::move(related_ev));
         }