Fix duplicate messages in timeline after sending

This commit is contained in:
Nicolas Werner 2020-01-14 20:43:35 +01:00
parent cdb11b1819
commit 54a16ae2d7

View file

@ -139,6 +139,17 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
});
connect(this, &TimelineModel::messageSent, this, [this](QString txn_id, QString event_id) {
pending.removeOne(txn_id);
// we could have received the message via sync
if (events.contains(event_id)) {
int idx = idToIndex(event_id);
if (idx >= 0) {
beginRemoveRows(QModelIndex(), idx, idx);
eventOrder.erase(eventOrder.begin() + idx);
endRemoveRows();
}
}
int idx = idToIndex(txn_id);
if (idx < 0) {
nhlog::ui()->warn("Sent index out of range");