Add redacting event via context menu

This commit is contained in:
vSLG 2020-03-26 17:31:57 -03:00 committed by miruka
parent 554f5d6013
commit b3f1075507
4 changed files with 58 additions and 0 deletions

View File

@ -875,6 +875,18 @@ class MatrixClient(nio.AsyncClient):
return (successes, errors)
async def room_mass_redact(
self, room_id: str, reason: str, *event_ids: str,
):
"""Redact events from a room in parallel.
Returns a list of sucessful redacts.
"""
return await asyncio.gather(*[
self.room_redact(room_id, evt_id, reason)
for evt_id in event_ids
])
async def generate_thumbnail(
self, data: UploadData, is_svg: bool = False,

View File

@ -218,6 +218,19 @@ HColumnLayout {
}
}
HMenuItemPopupSpawner {
icon.name: "remove-message"
text: qsTr("Remove")
popup: "Popups/RedactEvents.qml"
popupParent: chat
properties: ({
userId: chat.userId,
roomId: chat.roomId,
eventIds: [model.event_id]
})
}
HMenuItem {
icon.name: "debug"
text: qsTr("Debug this event")

View File

@ -0,0 +1,32 @@
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../Base"
BoxPopup {
summary.text:
eventIds.length > 1 ?
qsTr("Remove selected messages?") :
qsTr("Remove selected message?")
HLabeledTextField {
id: reasonField
label.text: qsTr("Reason (optional):")
Layout.fillWidth: true
}
okText: qsTr("Remove")
box.focusButton: "ok"
onOk: py.callClientCoro(
userId,
"room_mass_redact",
[roomId, reasonField.field.text, ...eventIds]
)
property string roomId: ""
property string userId: ""
property var eventIds: []
}

View File

@ -0,0 +1 @@
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd"><path d="M5.662 23l-5.369-5.365c-.195-.195-.293-.45-.293-.707 0-.256.098-.512.293-.707l14.929-14.928c.195-.194.451-.293.707-.293.255 0 .512.099.707.293l7.071 7.073c.196.195.293.451.293.708 0 .256-.097.511-.293.707l-11.216 11.219h5.514v2h-12.343zm3.657-2l-5.486-5.486-1.419 1.414 4.076 4.072h2.829zm6.605-17.581l-10.677 10.68 5.658 5.659 10.676-10.682-5.657-5.657z"/></svg>

After

Width:  |  Height:  |  Size: 475 B