summary refs log tree commit diff
path: root/src/timeline/TimelineModel.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-02-16 00:20:41 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2020-02-16 00:20:41 +0100
commitec9da9f42a29ef12e266ee1e05aebd17f98a3371 (patch)
tree00eccfc273cb12c930eb51917ec4ced09580ffd9 /src/timeline/TimelineModel.cpp
parentQuick hack to enable touch scrolling in settings and room list (diff)
downloadnheko-ec9da9f42a29ef12e266ee1e05aebd17f98a3371.tar.xz
Try to fix flickering, if sync return event before send completes
Diffstat (limited to 'src/timeline/TimelineModel.cpp')
-rw-r--r--src/timeline/TimelineModel.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp

index 104d564b..432cd329 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -538,6 +538,20 @@ TimelineModel::internalAddEvents( continue; } + QString txid = QString::fromStdString(mtx::accessors::transaction_id(e)); + if (this->pending.removeOne(txid)) { + this->events.insert(id, e); + this->events.remove(txid); + int idx = idToIndex(txid); + if (idx < 0) { + nhlog::ui()->warn("Received index out of range"); + continue; + } + eventOrder[idx] = id; + emit dataChanged(index(idx, 0), index(idx, 0)); + continue; + } + if (auto redaction = std::get_if<mtx::events::RedactionEvent<mtx::events::msg::Redaction>>(&e)) { QString redacts = QString::fromStdString(redaction->redacts);