Allow adding a reason for banning a user
This commit is contained in:
@@ -112,7 +112,10 @@ Kirigami.OverlaySheet {
|
||||
icon.name: "im-ban-user"
|
||||
icon.color: Kirigami.Theme.negativeTextColor
|
||||
onTriggered: {
|
||||
room.ban(user.id)
|
||||
applicationWindow().pageStack.pushDialogLayer("qrc:/BanSheet.qml", {room: room, userId: user.id}, {
|
||||
title: i18nc("@title", "Ban User"),
|
||||
width: Kirigami.Units.gridUnit * 25
|
||||
})
|
||||
root.close()
|
||||
}
|
||||
}
|
||||
|
||||
47
src/qml/Menu/Timeline/BanSheet.qml
Normal file
47
src/qml/Menu/Timeline/BanSheet.qml
Normal file
@@ -0,0 +1,47 @@
|
||||
// SPDX-FileCopyrightText: 2022 Tobias Fella <fella@posteo.de>
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15 as QQC2
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import org.kde.kirigami 2.20 as Kirigami
|
||||
|
||||
Kirigami.Page {
|
||||
id: banSheet
|
||||
|
||||
property var room
|
||||
property string userId
|
||||
|
||||
title: i18n("Ban User")
|
||||
|
||||
QQC2.TextArea {
|
||||
id: reason
|
||||
placeholderText: i18n("Reason for banning this user")
|
||||
anchors.fill: parent
|
||||
wrapMode: TextEdit.Wrap
|
||||
}
|
||||
|
||||
footer: QQC2.ToolBar {
|
||||
QQC2.DialogButtonBox {
|
||||
anchors.fill: parent
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
QQC2.Button {
|
||||
text: i18nc("@action:button 'Ban' as in 'Ban this user'", "Ban")
|
||||
icon.name: "im-ban-user"
|
||||
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.AcceptRole
|
||||
onClicked: {
|
||||
banSheet.room.ban(banSheet.userId, reason.text)
|
||||
banSheet.closeDialog()
|
||||
}
|
||||
}
|
||||
QQC2.Button {
|
||||
text: i18nc("@action", "Cancel")
|
||||
QQC2.DialogButtonBox.buttonRole: QQC2.DialogButtonBox.RejectRole
|
||||
onClicked: banSheet.closeDialog()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -92,5 +92,6 @@
|
||||
<file alias="DevtoolsPage.qml">qml/Page/DevtoolsPage.qml</file>
|
||||
<file alias="ConfirmEncryptionDialog.qml">qml/Dialog/ConfirmEncryptionDialog.qml</file>
|
||||
<file alias="RemoveSheet.qml">qml/Menu/Timeline/RemoveSheet.qml</file>
|
||||
<file alias="BanSheet.qml">qml/Menu/Timeline/BanSheet.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
Reference in New Issue
Block a user