Don't scroll up when clicking on the same room over and over

If you try to click on your current room in the list, it scrolls up the
messages a bit. This is because in RoomManager::visitRoom it's being
called with an empty eventId and we will happily emit a goToEvent. This
is despite there being nothing to go to.

Fixes #677.
This commit is contained in:
Joshua Goins
2024-11-15 22:37:56 -05:00
parent 9e90ac0412
commit 2379e3d83b

View File

@@ -315,7 +315,9 @@ void RoomManager::visitRoom(Room *r, const QString &eventId)
// It's important that we compare room *objects* here, not just room *ids*, since we need to deal with the object changing when going invite -> joined
if (m_currentRoom && m_currentRoom == room) {
Q_EMIT goToEvent(eventId);
if (!eventId.isEmpty()) {
Q_EMIT goToEvent(eventId);
}
} else {
setCurrentRoom(room->id());
}