From 358a39e6d2a5db9181a6dac1cb000ac8b85e15f2 Mon Sep 17 00:00:00 2001 From: Alexander Bantyev Date: Sat, 19 Jun 2021 23:26:21 +0300 Subject: [PATCH] fixup! Allow editing unsent messages --- src/timeline/EventStore.cpp | 6 +++++- src/timeline/TimelineModel.cpp | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp index 956698da..04f7ef76 100644 --- a/src/timeline/EventStore.cpp +++ b/src/timeline/EventStore.cpp @@ -186,7 +186,11 @@ EventStore::EventStore(std::string room_id, QObject *) nhlog::ui()->debug("sent {}", txn_id); // Replace the event_id in pending edits/replies/redactions with the actual - // event_id of this event + // event_id of this event. This allows one to edit and reply to events that are + // currently pending. + + // FIXME (introduced by balsoft): this doesn't work for encrypted events, but + // allegedly it's hard to fix so I'll leave my first contribution at that for (auto related_event_id : cache::client()->relatedEvents(room_id_, txn_id)) { if (cache::client()->getEvent(room_id_, related_event_id)) { auto related_event = diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 4bff15eb..99547b15 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -375,6 +375,8 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj connect(&events, &EventStore::updateFlowEventId, this, [this](std::string event_id) { this->updateFlowEventId(event_id); }); + // When a message is sent, check if the current edit/reply relates to that message, + // and update the event_id so that it points to the sent message and not the pending one. connect(&events, &EventStore::messageSent, this,