Fix off-by-1 in insertRows when loading room list from initial sync
This commit is contained in:
parent
68851ee5aa
commit
801af1864c
2 changed files with 4 additions and 3 deletions
|
|
@ -348,7 +348,7 @@ RoomlistModel::addRoom(const QString &room_id, bool suppressInsertNotification)
|
|||
beginInsertRows(QModelIndex(),
|
||||
(int)roomids.size(),
|
||||
(int)(roomids.size() + previewsToAdd.size() -
|
||||
((wasInvite || wasPreview) ? 0 : 1)));
|
||||
((wasInvite || wasPreview) ? 1 : 0)));
|
||||
|
||||
models.insert(room_id, std::move(newRoom));
|
||||
if (wasInvite) {
|
||||
|
|
@ -368,7 +368,8 @@ RoomlistModel::addRoom(const QString &room_id, bool suppressInsertNotification)
|
|||
roomids.push_back(std::move(p));
|
||||
}
|
||||
|
||||
if (!suppressInsertNotification && !wasInvite)
|
||||
if (!suppressInsertNotification &&
|
||||
((!wasInvite && !wasPreview) || !previewedRooms.empty()))
|
||||
endInsertRows();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue