Fix old messages being played back after limit reset

This commit is contained in:
Nicolas Werner 2021-01-24 20:02:24 +01:00
parent fc76a939bb
commit f0102c1e55

View file

@ -229,6 +229,9 @@ EventStore::clearTimeline()
} }
nhlog::ui()->info("Range {} {}", this->last, this->first); nhlog::ui()->info("Range {} {}", this->last, this->first);
decryptedEvents_.clear();
events_.clear();
emit endResetModel(); emit endResetModel();
} }
@ -265,6 +268,9 @@ EventStore::handleSync(const mtx::responses::Timeline &events)
emit beginResetModel(); emit beginResetModel();
this->first = std::numeric_limits<uint64_t>::max(); this->first = std::numeric_limits<uint64_t>::max();
this->last = std::numeric_limits<uint64_t>::max(); this->last = std::numeric_limits<uint64_t>::max();
decryptedEvents_.clear();
events_.clear();
emit endResetModel(); emit endResetModel();
return; return;
} }
@ -273,6 +279,9 @@ EventStore::handleSync(const mtx::responses::Timeline &events)
emit beginResetModel(); emit beginResetModel();
this->last = range->last; this->last = range->last;
this->first = range->first; this->first = range->first;
decryptedEvents_.clear();
events_.clear();
emit endResetModel(); emit endResetModel();
} else if (range->last > this->last) { } else if (range->last > this->last) {
emit beginInsertRows(toExternalIdx(this->last + 1), toExternalIdx(range->last)); emit beginInsertRows(toExternalIdx(this->last + 1), toExternalIdx(range->last));