forked from mirrors/akkoma
Fix broken attachments from owncast (#31)
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/31
This commit is contained in:
parent
2937495712
commit
3f7c64f30b
|
@ -108,6 +108,7 @@ defp fix(data) do
|
|||
|> fix_replies()
|
||||
|> fix_source()
|
||||
|> fix_misskey_content()
|
||||
|> Transmogrifier.fix_attachments()
|
||||
|> Transmogrifier.fix_emoji()
|
||||
|> Transmogrifier.fix_content_map()
|
||||
end
|
||||
|
|
31
test/fixtures/owncast-note-with-attachment.json
vendored
Normal file
31
test/fixtures/owncast-note-with-attachment.json
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"attachment": {
|
||||
"content": "Live stream preview",
|
||||
"type": "Image",
|
||||
"url": "https://owncast.localhost.localdomain/preview.gif?us=KjfNX387gm"
|
||||
},
|
||||
"attributedTo": "https://owncast.localhost.localdomain/federation/user/streamer",
|
||||
"audience": "https://www.w3.org/ns/activitystreams#Public",
|
||||
"content": "<p>I've gone live!</p><p></p><p><a class=\"hashtag\" href=\"https://directory.owncast.online/tags/owncast\">#owncast</a> <a class=\"hashtag\" href=\"https://directory.owncast.online/tags/streaming\">#streaming</a></p><a href=\"https://owncast.localhost.localdomain\">https://owncast.localhost.localdomain</a>",
|
||||
"id": "https://owncast.localhost.localdomain/federation/KjBNuq8ng",
|
||||
"published": "2022-04-17T15:42:03Z",
|
||||
"tag": [
|
||||
{
|
||||
"href": "https://directory.owncast.online/tags/owncast",
|
||||
"name": "#owncast",
|
||||
"type": "Hashtag"
|
||||
},
|
||||
{
|
||||
"href": "https://directory.owncast.online/tags/streaming",
|
||||
"name": "#streaming",
|
||||
"type": "Hashtag"
|
||||
},
|
||||
{
|
||||
"href": "https://directory.owncast.online/tags/owncast",
|
||||
"name": "#owncast",
|
||||
"type": "Hashtag"
|
||||
}
|
||||
],
|
||||
"to": "https://www.w3.org/ns/activitystreams#Public",
|
||||
"type": "Note"
|
||||
}
|
|
@ -52,5 +52,16 @@ test "a note with a remote replies collection should validate", _ do
|
|||
%{valid?: true, changes: %{replies: ["https://bookwyrm.com/user/TestUser/status/18"]}} =
|
||||
ArticleNotePageValidator.cast_and_validate(note)
|
||||
end
|
||||
|
||||
test "a note with an attachment should work", _ do
|
||||
insert(:user, %{ap_id: "https://owncast.localhost.localdomain/federation/user/streamer"})
|
||||
|
||||
note =
|
||||
"test/fixtures/owncast-note-with-attachment.json"
|
||||
|> File.read!()
|
||||
|> Jason.decode!()
|
||||
|
||||
%{valid?: true} = ArticleNotePageValidator.cast_and_validate(note)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue