Fix edits not updating in replies
This commit is contained in:
parent
ef9ebe3fd3
commit
bcc6c518be
@ -384,6 +384,7 @@ EventStore::handleSync(const mtx::responses::Timeline &events)
|
|||||||
|
|
||||||
for (const auto &event : events.events) {
|
for (const auto &event : events.events) {
|
||||||
std::set<std::string> relates_to;
|
std::set<std::string> relates_to;
|
||||||
|
std::string edited_event;
|
||||||
if (auto redaction =
|
if (auto redaction =
|
||||||
std::get_if<mtx::events::RedactionEvent<mtx::events::msg::Redaction>>(&event)) {
|
std::get_if<mtx::events::RedactionEvent<mtx::events::msg::Redaction>>(&event)) {
|
||||||
// fixup reactions
|
// fixup reactions
|
||||||
@ -402,8 +403,12 @@ EventStore::handleSync(const mtx::responses::Timeline &events)
|
|||||||
|
|
||||||
relates_to.insert(redaction->redacts);
|
relates_to.insert(redaction->redacts);
|
||||||
} else {
|
} else {
|
||||||
for (const auto &r : mtx::accessors::relations(event).relations)
|
for (const auto &r : mtx::accessors::relations(event).relations) {
|
||||||
relates_to.insert(r.event_id);
|
relates_to.insert(r.event_id);
|
||||||
|
|
||||||
|
if (r.rel_type == mtx::common::RelationType::Replace)
|
||||||
|
edited_event = r.event_id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto &relates_to_id : relates_to) {
|
for (const auto &relates_to_id : relates_to) {
|
||||||
@ -425,6 +430,16 @@ EventStore::handleSync(const mtx::responses::Timeline &events)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!edited_event.empty()) {
|
||||||
|
for (const auto &downstream_event :
|
||||||
|
cache::client()->relatedEvents(room_id_, edited_event)) {
|
||||||
|
auto idx = cache::client()->getTimelineIndex(room_id_, downstream_event);
|
||||||
|
if (idx) {
|
||||||
|
emit dataChanged(toExternalIdx(*idx), toExternalIdx(*idx));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// decrypting and checking some encrypted messages
|
// decrypting and checking some encrypted messages
|
||||||
if (auto encrypted =
|
if (auto encrypted =
|
||||||
std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(&event)) {
|
std::get_if<mtx::events::EncryptedEvent<mtx::events::msg::Encrypted>>(&event)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user