summary refs log tree commit diff
path: root/src/timeline/EventStore.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-07-20 00:42:48 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-07-20 00:42:48 +0200
commit19f27236ea82b1927c83e4e24c71b30061674ee7 (patch)
tree1f6449488bbbd4dc23827253bbf56096f8f949e7 /src/timeline/EventStore.cpp
parentFix reaction display (diff)
downloadnheko-19f27236ea82b1927c83e4e24c71b30061674ee7.tar.xz
Fix reactions
Diffstat (limited to 'src/timeline/EventStore.cpp')
-rw-r--r--src/timeline/EventStore.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp

index 0bd7a97e..eb1162cc 100644 --- a/src/timeline/EventStore.cpp +++ b/src/timeline/EventStore.cpp
@@ -202,6 +202,20 @@ EventStore::handleSync(const mtx::responses::Timeline &events) if (auto redaction = std::get_if<mtx::events::RedactionEvent<mtx::events::msg::Redaction>>( &event)) { + // fixup reactions + auto redacted = events_by_id_.object({room_id_, redaction->redacts}); + if (redacted) { + auto id = mtx::accessors::relates_to_event_id(*redacted); + if (!id.empty()) { + auto idx = idToIndex(id); + if (idx) { + events_by_id_.remove( + {room_id_, redaction->redacts}); + emit dataChanged(*idx, *idx); + } + } + } + relates_to = redaction->redacts; } else if (auto reaction = std::get_if<mtx::events::RoomEvent<mtx::events::msg::Reaction>>(