Fix day separator when loading older messages

fixes #632
This commit is contained in:
Nicolas Werner 2021-09-08 12:47:44 +02:00
parent c7e884c454
commit 495a4334df
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 10 additions and 12 deletions

View file

@ -71,11 +71,14 @@ EventStore::EventStore(std::string room_id, QObject *)
fetchMore();
else {
if (this->last != std::numeric_limits<uint64_t>::max()) {
auto oldFirst = this->first;
emit beginInsertRows(toExternalIdx(newFirst),
toExternalIdx(this->first - 1));
this->first = newFirst;
emit endInsertRows();
emit fetchedMore();
emit dataChanged(toExternalIdx(oldFirst),
toExternalIdx(oldFirst));
} else {
auto range = cache::client()->getTimelineRange(room_id_);

View file

@ -354,18 +354,13 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, QString room_id, QObj
Qt::QueuedConnection);
connect(this, &TimelineModel::addPendingMessageToStore, &events, &EventStore::addPending);
connect(
&events,
&EventStore::dataChanged,
this,
[this](int from, int to) {
connect(&events, &EventStore::dataChanged, this, [this](int from, int to) {
relatedEventCacheBuster++;
nhlog::ui()->debug(
"data changed {} to {}", events.size() - to - 1, events.size() - from - 1);
emit dataChanged(index(events.size() - to - 1, 0),
index(events.size() - from - 1, 0));
},
Qt::QueuedConnection);
});
connect(&events, &EventStore::beginInsertRows, this, [this](int from, int to) {
int first = events.size() - to;