Refactor `LinkPreviewer` to take an event and put the functions for getting the link in the class itself. This means the functions in `EventHandler` are no longer required. This mr also sets up `LinkPreviewer` so that it is automatically updated when an event is edited. This includes changing the link if edited, and it can handle a message having a previous link removed or a one added when one didn't exist before. Also adds test suite.
36 lines
937 B
JSON
36 lines
937 B
JSON
{
|
|
"timeline": {
|
|
"events": [
|
|
{
|
|
"content": {
|
|
"body": "* ",
|
|
"format": "org.matrix.custom.html",
|
|
"formatted_body": "no link",
|
|
"m.new_content": {
|
|
"body": "",
|
|
"format": "org.matrix.custom.html",
|
|
"formatted_body": "no link",
|
|
"msgtype": "m.text"
|
|
},
|
|
"m.relates_to": {
|
|
"event_id": "$validlink:example.org",
|
|
"rel_type": "m.replace"
|
|
},
|
|
"msgtype": "m.text",
|
|
"type": "m.room.message"
|
|
},
|
|
"origin_server_ts": 1704648614969,
|
|
"sender": "@example:example.org",
|
|
"type": "m.room.message",
|
|
"unsigned": {
|
|
"age": 65
|
|
},
|
|
"event_id": "$nolink:example.org",
|
|
"room_id": "!test:example.org"
|
|
}
|
|
],
|
|
"limited": true,
|
|
"prev_batch": "t34-23535_0_0"
|
|
}
|
|
}
|