mirror of
https://gitdab.com/cadence/out-of-your-element.git
synced 2025-09-10 20:32:50 +02:00
m->d: fix image captions spec, fix upload issues
This commit is contained in:
parent
050cc9cee9
commit
a8670323a0
10 changed files with 203 additions and 97 deletions
|
@ -3770,7 +3770,7 @@ test("event2message: text attachments work", async t => {
|
|||
username: "cadence [they]",
|
||||
content: "",
|
||||
avatar_url: "https://bridge.example.org/download/matrix/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
|
||||
attachments: [{id: "0", description: undefined, filename: "chiki-powerups.txt"}],
|
||||
attachments: [{id: "0", filename: "chiki-powerups.txt"}],
|
||||
pendingFiles: [{name: "chiki-powerups.txt", mxc: "mxc://cadence.moe/zyThGlYQxvlvBVbVgKDDbiHH"}]
|
||||
}]
|
||||
}
|
||||
|
@ -3806,14 +3806,14 @@ test("event2message: image attachments work", async t => {
|
|||
username: "cadence [they]",
|
||||
content: "",
|
||||
avatar_url: "https://bridge.example.org/download/matrix/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
|
||||
attachments: [{id: "0", description: undefined, filename: "cool cat.png"}],
|
||||
attachments: [{id: "0", filename: "cool cat.png"}],
|
||||
pendingFiles: [{name: "cool cat.png", mxc: "mxc://cadence.moe/IvxVJFLEuksCNnbojdSIeEvn"}]
|
||||
}]
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test("event2message: image attachments can have a custom description", async t => {
|
||||
test("event2message: image attachments can have a plaintext caption", async t => {
|
||||
t.deepEqual(
|
||||
await eventToMessage({
|
||||
type: "m.room.message",
|
||||
|
@ -3840,10 +3840,62 @@ test("event2message: image attachments can have a custom description", async t =
|
|||
messagesToEdit: [],
|
||||
messagesToSend: [{
|
||||
username: "cadence [they]",
|
||||
content: "",
|
||||
content: "Cat emoji surrounded by pink hearts",
|
||||
avatar_url: "https://bridge.example.org/download/matrix/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
|
||||
attachments: [{id: "0", description: "Cat emoji surrounded by pink hearts", filename: "cool cat.png"}],
|
||||
pendingFiles: [{name: "cool cat.png", mxc: "mxc://cadence.moe/IvxVJFLEuksCNnbojdSIeEvn"}]
|
||||
attachments: [{id: "0", filename: "cool cat.png"}],
|
||||
pendingFiles: [{name: "cool cat.png", mxc: "mxc://cadence.moe/IvxVJFLEuksCNnbojdSIeEvn"}],
|
||||
allowed_mentions: {
|
||||
parse: ["users", "roles"]
|
||||
}
|
||||
}]
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test("event2message: image attachments can have a formatted caption", async t => {
|
||||
t.deepEqual(
|
||||
await eventToMessage({
|
||||
content: {
|
||||
body: "this event has `formatting`",
|
||||
filename: "5740.jpg",
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body: "this event has <code>formatting</code>",
|
||||
info: {
|
||||
h: 1340,
|
||||
mimetype: "image/jpeg",
|
||||
size: 226689,
|
||||
thumbnail_info: {
|
||||
h: 670,
|
||||
mimetype: "image/jpeg",
|
||||
size: 80157,
|
||||
w: 540
|
||||
},
|
||||
thumbnail_url: "mxc://thomcat.rocks/XhLsOCDBYyearsLQgUUrbAvw",
|
||||
w: 1080,
|
||||
"xyz.amorgan.blurhash": "KHJQG*55ic-.}?0M58J.9v"
|
||||
},
|
||||
msgtype: "m.image",
|
||||
url: "mxc://thomcat.rocks/RTHsXmcMPXmuHqVNsnbKtRbh"
|
||||
},
|
||||
origin_server_ts: 1740607766895,
|
||||
sender: "@cadence:cadence.moe",
|
||||
type: "m.room.message",
|
||||
event_id: "$NqNqVgukiQm1nynm9vIr9FIq31hZpQ3udOd7cBIW46U",
|
||||
room_id: "!BnKuBPCvyfOkhcUjEu:cadence.moe"
|
||||
}),
|
||||
{
|
||||
ensureJoined: [],
|
||||
messagesToDelete: [],
|
||||
messagesToEdit: [],
|
||||
messagesToSend: [{
|
||||
username: "cadence [they]",
|
||||
content: "this event has `formatting`",
|
||||
avatar_url: "https://bridge.example.org/download/matrix/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
|
||||
attachments: [{id: "0", filename: "5740.jpg"}],
|
||||
pendingFiles: [{name: "5740.jpg", mxc: "mxc://thomcat.rocks/RTHsXmcMPXmuHqVNsnbKtRbh"}],
|
||||
allowed_mentions: {
|
||||
parse: ["users", "roles"]
|
||||
}
|
||||
}]
|
||||
}
|
||||
)
|
||||
|
@ -3892,7 +3944,7 @@ test("event2message: encrypted image attachments work", async t => {
|
|||
username: "cadence [they]",
|
||||
content: "",
|
||||
avatar_url: "https://bridge.example.org/download/matrix/cadence.moe/azCAhThKTojXSZJRoWwZmhvU",
|
||||
attachments: [{id: "0", description: undefined, filename: "image.png"}],
|
||||
attachments: [{id: "0", filename: "image.png"}],
|
||||
pendingFiles: [{
|
||||
name: "image.png",
|
||||
mxc: "mxc://heyquark.com/LOGkUTlVFrqfiExlGZNgCJJX",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue