mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 13:08:48 +03:00
Switch to room after joining invite
This commit is contained in:
parent
0a4e95a1db
commit
47899ee7ed
1 changed files with 10 additions and 9 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "Cache_p.h"
|
#include "Cache_p.h"
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
|
#include "Logging.h"
|
||||||
#include "MatrixClient.h"
|
#include "MatrixClient.h"
|
||||||
#include "MxcImageProvider.h"
|
#include "MxcImageProvider.h"
|
||||||
#include "TimelineModel.h"
|
#include "TimelineModel.h"
|
||||||
|
@ -363,6 +364,13 @@ RoomlistModel::addRoom(const QString &room_id, bool suppressInsertNotification)
|
||||||
roomids.push_back(room_id);
|
roomids.push_back(room_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((wasInvite || wasPreview) && currentRoomPreview_ &&
|
||||||
|
currentRoomPreview_->roomid() == room_id) {
|
||||||
|
currentRoom_ = models.value(room_id);
|
||||||
|
currentRoomPreview_.reset();
|
||||||
|
emit currentRoomChanged();
|
||||||
|
}
|
||||||
|
|
||||||
for (auto p : previewsToAdd) {
|
for (auto p : previewsToAdd) {
|
||||||
previewedRooms.insert(p, std::nullopt);
|
previewedRooms.insert(p, std::nullopt);
|
||||||
roomids.push_back(std::move(p));
|
roomids.push_back(std::move(p));
|
||||||
|
@ -557,17 +565,10 @@ void
|
||||||
RoomlistModel::acceptInvite(QString roomid)
|
RoomlistModel::acceptInvite(QString roomid)
|
||||||
{
|
{
|
||||||
if (invites.contains(roomid)) {
|
if (invites.contains(roomid)) {
|
||||||
auto idx = roomidToIndex(roomid);
|
// Don't remove invite yet, so that we can switch to it
|
||||||
|
|
||||||
if (idx != -1) {
|
|
||||||
beginRemoveRows(QModelIndex(), idx, idx);
|
|
||||||
roomids.erase(roomids.begin() + idx);
|
|
||||||
invites.remove(roomid);
|
|
||||||
endRemoveRows();
|
|
||||||
ChatPage::instance()->joinRoom(roomid);
|
ChatPage::instance()->joinRoom(roomid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
void
|
void
|
||||||
RoomlistModel::declineInvite(QString roomid)
|
RoomlistModel::declineInvite(QString roomid)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue