Fix a few join confirmations too many

This commit is contained in:
Nicolas Werner 2021-03-05 14:59:59 +01:00
parent 626d8bf151
commit f4164cc799
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
2 changed files with 13 additions and 8 deletions

View file

@ -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<std::string> &via)
ChatPage::joinRoomVia(const std::string &room_id,
const std::vector<std::string> &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(

View file

@ -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<std::string> &via);
void joinRoomVia(const std::string &room_id,
const std::vector<std::string> &via,
bool promptForConfirmation = true);
void inviteUser(QString userid, QString reason);
void kickUser(QString userid, QString reason);