Refactor room leaving
The old code has a small bug where the room would not be left in certain conditions.
This commit is contained in:
committed by
Carl Schwan
parent
21bd5fa94e
commit
ecc639fb0a
@@ -215,18 +215,14 @@ void RoomManager::reset()
|
||||
|
||||
void RoomManager::leaveRoom(NeoChatRoom *room)
|
||||
{
|
||||
// close the room and open the last open room if it exist
|
||||
// other open welcome page.
|
||||
if(m_lastCurrentRoom && room->id() == m_lastCurrentRoom->id()) {
|
||||
m_lastCurrentRoom = nullptr;
|
||||
}
|
||||
if (m_currentRoom && m_currentRoom->id() == room->id()) {
|
||||
if (!m_lastCurrentRoom) {
|
||||
Q_EMIT pushWelcomePage();
|
||||
return;
|
||||
}
|
||||
m_currentRoom = m_lastCurrentRoom;
|
||||
m_lastCurrentRoom = nullptr;
|
||||
|
||||
Q_EMIT currentRoomChanged();
|
||||
Q_EMIT replaceRoom(m_lastCurrentRoom, QString());
|
||||
}
|
||||
|
||||
room->forget();
|
||||
|
||||
Reference in New Issue
Block a user