Add report buttons to spaces

This allows you to report harmful spaces that you already joined in,
similar to the current UX for rooms.

Note that you can't report subspaces or rooms within said spaces yet,
that requires hover actions (or ideally a context menu) that don't exist
yet.

See #707
This commit is contained in:
Joshua Goins
2026-02-20 16:40:55 -05:00
parent b49ce25246
commit a60d6c4a60
2 changed files with 43 additions and 0 deletions

View File

@@ -81,6 +81,28 @@ KirigamiComponents.ConvergentContextMenu {
separator: true
}
Kirigami.Action {
text: i18nc("@action:button 'Report' as in 'Report this space to the administrators'", "Report…")
icon.name: "dialog-warning-symbolic"
visible: root.connection.supportsMatrixSpecVersion("v1.13")
onTriggered: {
let dialog = (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
title: i18nc("@title:dialog", "Report Space"),
placeholder: i18nc("@info:placeholder", "Optionally give a reason for reporting this space"),
icon: "dialog-warning-symbolic",
actionText: i18nc("@action:button 'Report' as in 'Report this space to the administrators'", "Report"),
reporting: true,
connection: root.connection,
}, {
title: i18nc("@title", "Report Space"),
width: Kirigami.Units.gridUnit * 25
}) as ReasonDialog;
dialog.accepted.connect(reason => {
root.room.report(reason);
});
}
}
QQC2.Action {
text: i18nc("'Space' is a matrix space", "Leave Space…")
icon.name: "go-previous"

View File

@@ -105,6 +105,27 @@ ColumnLayout {
Item {
Layout.fillWidth: true
}
QQC2.Button {
text: i18nc("@action:button 'Report' as in 'Report this space to the administrators'", "Report…")
icon.name: "dialog-warning-symbolic"
visible: root.connection.supportsMatrixSpecVersion("v1.13")
onClicked: {
let dialog = (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent('org.kde.neochat', 'ReasonDialog'), {
title: i18nc("@title:dialog", "Report Space"),
placeholder: i18nc("@info:placeholder", "Optionally give a reason for reporting this space"),
icon: "dialog-warning-symbolic",
actionText: i18nc("@action:button 'Report' as in 'Report this space to the administrators'", "Report"),
reporting: true,
connection: root.room.connection,
}, {
title: i18nc("@title", "Report Space"),
width: Kirigami.Units.gridUnit * 25
}) as ReasonDialog;
dialog.accepted.connect(reason => {
root.room.report(reason);
});
}
}
QQC2.Button {
id: settingsButton