diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-12-08 20:19:25 +0300 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2019-12-08 21:06:18 +0300 |
commit | 77f1ca99ade62565ce30758005b911eb340953e6 (patch) | |
tree | 2a17e744fe334fb5c60d1cf86027f0a949987aeb /lib | |
parent | f0d241c6bb8fb3219736ec6ead20564bcea9a991 (diff) | |
download | libquotient-77f1ca99ade62565ce30758005b911eb340953e6.tar.gz libquotient-77f1ca99ade62565ce30758005b911eb340953e6.zip |
Room::addNewMessageEvents: search the whole sync batch for events to
redact
It seems that sometimes redactions may precede the unredacted events
within the same sync batch.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/room.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/room.cpp b/lib/room.cpp index be07ce50..198cef0d 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -2122,12 +2122,10 @@ Room::Changes Room::Private::addNewMessageEvents(RoomEvents&& events) // Try to find the target in the timeline, then in the batch. if (processRedaction(*r)) continue; - auto targetIt = std::find_if(events.begin(), it, - [id = r->redactedEvent()]( - const RoomEventPtr& ep) { - return ep->id() == id; - }); - if (targetIt != it) + if (auto targetIt = std::find_if(events.begin(), events.end(), + [id = r->redactedEvent()](const RoomEventPtr& ep) { + return ep->id() == id; + }); targetIt != events.end()) *targetIt = makeRedacted(**targetIt, *r); else qCDebug(EVENTS) |