Compare commits
No commits in common. "141ae835dfdd1300cbff40e98e0c3a78f44671ec" and "e0d96cde1975a437551f8f513d81012bb361dfcf" have entirely different histories.
141ae835df
...
e0d96cde19
2 changed files with 1 additions and 29 deletions
|
@ -129,7 +129,6 @@ turndownService.addRule("inlineLink", {
|
|||
let brackets = ["", ""]
|
||||
content = content.replace(/ @.*/, "")
|
||||
if (href.startsWith("https://matrix.to")) brackets = ["<", ">"]
|
||||
if (href === content) return brackets[0] + href + brackets[1]
|
||||
if (href.startsWith("https://matrix.to/#/@") && content[0] !== "@") content = "@" + content
|
||||
return "[" + content + "](" + brackets[0] + href + brackets[1] + ")"
|
||||
}
|
||||
|
|
|
@ -172,33 +172,6 @@ test("event2message: links in plaintext body are not broken", async t => {
|
|||
)
|
||||
})
|
||||
|
||||
test("event2message: links in formatted body where the text & href are the same, just post the link once", async t => {
|
||||
t.deepEqual(
|
||||
await eventToMessage({
|
||||
sender: "@cadence:cadence.moe",
|
||||
type: "m.room.message",
|
||||
content: {
|
||||
body: "https://privatebin.net/?9111cb16f28da21b#62CKkEr6WvXZ1gQv2M6agazsA7tGYX8ZP8drETYujYZr",
|
||||
format: "org.matrix.custom.html",
|
||||
formatted_body: "<a href=\"https://privatebin.net/?9111cb16f28da21b#62CKkEr6WvXZ1gQv2M6agazsA7tGYX8ZP8drETYujYZr\">https://privatebin.net/?9111cb16f28da21b#62CKkEr6WvXZ1gQv2M6agazsA7tGYX8ZP8drETYujYZr</a>",
|
||||
msgtype: "m.text"
|
||||
},
|
||||
room_id: "!kLRqKKUQXcibIMtOpl:cadence.moe",
|
||||
event_id: "$p3AOv1eReiSH0g06_8AZ0WH0qSeaGdqwHhiNx_hz-bs",
|
||||
}),
|
||||
{
|
||||
ensureJoined: [],
|
||||
messagesToDelete: [],
|
||||
messagesToEdit: [],
|
||||
messagesToSend: [{
|
||||
username: "cadence [they]",
|
||||
content: "https://privatebin.net/?9111cb16f28da21b#62CKkEr6WvXZ1gQv2M6agazsA7tGYX8ZP8drETYujYZr",
|
||||
avatar_url: undefined
|
||||
}]
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
test("event2message: basic html is converted to markdown", async t => {
|
||||
t.deepEqual(
|
||||
await eventToMessage({
|
||||
|
@ -2691,7 +2664,7 @@ test("event2message: link to event in an unknown room", async t => {
|
|||
messagesToEdit: [],
|
||||
messagesToSend: [{
|
||||
username: "cadence [they]",
|
||||
content: "ah yeah, here's where the bug was reported: <https://matrix.to/#/!QtykxKocfZaZOUrTwp:matrix.org/$1542477546853947KGhZL:matrix.org>",
|
||||
content: "ah yeah, here's where the bug was reported: [https://matrix.to/#/!QtykxKocfZaZOUrTwp:matrix.org/$1542477546853947KGhZL:matrix.org](<https://matrix.to/#/!QtykxKocfZaZOUrTwp:matrix.org/$1542477546853947KGhZL:matrix.org>)",
|
||||
avatar_url: undefined
|
||||
}]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue