mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Add GUI for specifying kick/ban reason
This replaces the are-you-sure dialog and also shows up when using /-commands. Closes: https://github.com/Nheko-Reborn/nheko/issues/239 # Previous commits: #e390c398
Allow to specify reason for removed message #5949173b
Add function to force focus on InputDialog input field #9482ac4e
Allow explicit selection of SSO method #ab05e2d8
Mobile message input (#962)
This commit is contained in:
parent
e390c39862
commit
083562a7d8
1 changed files with 22 additions and 9 deletions
|
@ -785,11 +785,18 @@ ChatPage::kickUser(QString userid, QString reason)
|
||||||
{
|
{
|
||||||
auto room = currentRoom();
|
auto room = currentRoom();
|
||||||
|
|
||||||
if (QMessageBox::question(nullptr,
|
bool confirmed;
|
||||||
tr("Confirm kick"),
|
reason =
|
||||||
tr("Do you really want to kick %1 (%2)?")
|
QInputDialog::getText(nullptr,
|
||||||
.arg(cache::displayName(room, userid), userid)) != QMessageBox::Yes)
|
tr("Reason for the kick"),
|
||||||
|
tr("Enter reason for kicking %1 (%2) or hit enter for no reason:")
|
||||||
|
.arg(cache::displayName(room, userid), userid),
|
||||||
|
QLineEdit::Normal,
|
||||||
|
reason,
|
||||||
|
&confirmed);
|
||||||
|
if (!confirmed) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
http::client()->kick_user(
|
http::client()->kick_user(
|
||||||
room.toStdString(),
|
room.toStdString(),
|
||||||
|
@ -809,12 +816,18 @@ ChatPage::banUser(QString userid, QString reason)
|
||||||
{
|
{
|
||||||
auto room = currentRoom();
|
auto room = currentRoom();
|
||||||
|
|
||||||
if (QMessageBox::question(
|
bool confirmed;
|
||||||
nullptr,
|
reason =
|
||||||
tr("Confirm ban"),
|
QInputDialog::getText(nullptr,
|
||||||
tr("Do you really want to ban %1 (%2)?").arg(cache::displayName(room, userid), userid)) !=
|
tr("Reason for the ban"),
|
||||||
QMessageBox::Yes)
|
tr("Enter reason for banning %1 (%2) or hit enter for no reason:")
|
||||||
|
.arg(cache::displayName(room, userid), userid),
|
||||||
|
QLineEdit::Normal,
|
||||||
|
reason,
|
||||||
|
&confirmed);
|
||||||
|
if (!confirmed) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
http::client()->ban_user(
|
http::client()->ban_user(
|
||||||
room.toStdString(),
|
room.toStdString(),
|
||||||
|
|
Loading…
Reference in a new issue