From f4164cc799736f1f9a31ea559be3ee618ba737f2 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Fri, 5 Mar 2021 14:59:59 +0100 Subject: [PATCH] Fix a few join confirmations too many --- src/ChatPage.cpp | 17 ++++++++++------- src/ChatPage.h | 4 +++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp index 8efdab2e..f2d6b06c 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp @@ -901,17 +901,20 @@ void ChatPage::joinRoom(const QString &room) { const auto room_id = room.toStdString(); - joinRoomVia(room_id, {}); + joinRoomVia(room_id, {}, false); } void -ChatPage::joinRoomVia(const std::string &room_id, const std::vector &via) +ChatPage::joinRoomVia(const std::string &room_id, + const std::vector &via, + bool promptForConfirmation) { - if (QMessageBox::Yes != - QMessageBox::question( - this, - tr("Confirm join"), - tr("Do you really want to join %1?").arg(QString::fromStdString(room_id)))) + if (promptForConfirmation && + QMessageBox::Yes != + QMessageBox::question( + this, + tr("Confirm join"), + tr("Do you really want to join %1?").arg(QString::fromStdString(room_id)))) return; http::client()->join_room( diff --git a/src/ChatPage.h b/src/ChatPage.h index 6c16926d..f2078f45 100644 --- a/src/ChatPage.h +++ b/src/ChatPage.h @@ -105,7 +105,9 @@ public slots: void leaveRoom(const QString &room_id); void createRoom(const mtx::requests::CreateRoom &req); void joinRoom(const QString &room); - void joinRoomVia(const std::string &room_id, const std::vector &via); + void joinRoomVia(const std::string &room_id, + const std::vector &via, + bool promptForConfirmation = true); void inviteUser(QString userid, QString reason); void kickUser(QString userid, QString reason);