Allow "replying" to an event with a file
Send a pseudo-reply consisting of two messages: a `m.text` which is just a reply with an empty body, then the file event itself. This is a workaround to the restriction imposed by the Matrix API, which prevents us from simply attaching a reply to a media event: https://matrix.org/docs/spec/client_server/latest#rich-replies
This commit is contained in:
@@ -16,6 +16,9 @@ HColumnPopup {
|
||||
property string userId
|
||||
property string roomId
|
||||
property string roomName
|
||||
property string replyToEventId: ""
|
||||
|
||||
signal replied()
|
||||
|
||||
|
||||
contentWidthLimit: theme.controls.popup.defaultWidth * 1.25
|
||||
@@ -26,11 +29,14 @@ HColumnPopup {
|
||||
text: qsTr("Send")
|
||||
icon.name: "confirm-uploading-file"
|
||||
onClicked: {
|
||||
py.callClientCoro(
|
||||
popup.userId,
|
||||
"send_clipboard_image",
|
||||
[popup.roomId, Clipboard.image],
|
||||
)
|
||||
const args = [
|
||||
popup.roomId,
|
||||
Clipboard.image,
|
||||
popup.replyToEventId || undefined,
|
||||
]
|
||||
|
||||
py.callClientCoro(popup.userId, "send_clipboard_image", args)
|
||||
if (popup.replyToEventId) popup.replied()
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
@@ -13,9 +13,12 @@ HColumnPopup {
|
||||
property string roomId
|
||||
property string roomName
|
||||
property string filePath
|
||||
property string replyToEventId: ""
|
||||
|
||||
readonly property string fileName: filePath.split("/").slice(-1)[0]
|
||||
|
||||
signal replied()
|
||||
|
||||
|
||||
contentWidthLimit: theme.controls.popup.defaultWidth * 1.25
|
||||
|
||||
@@ -25,9 +28,14 @@ HColumnPopup {
|
||||
text: qsTr("Send")
|
||||
icon.name: "confirm-uploading-file"
|
||||
onClicked: {
|
||||
py.callClientCoro(
|
||||
popup.userId, "send_file", [popup.roomId, filePath],
|
||||
)
|
||||
const args = [
|
||||
popup.roomId,
|
||||
popup.filePath,
|
||||
popup.replyToEventId || undefined,
|
||||
]
|
||||
|
||||
py.callClientCoro(popup.userId, "send_file", args)
|
||||
if (popup.replyToEventId) popup.replied()
|
||||
popup.close()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user