only link in content
field
Some checks failed
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/pr/release Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline failed
ci/woodpecker/pr/test Pipeline was successful
Some checks failed
ci/woodpecker/push/release Pipeline was successful
ci/woodpecker/pr/release Pipeline was successful
ci/woodpecker/pr/lint Pipeline was successful
ci/woodpecker/push/lint Pipeline was successful
ci/woodpecker/push/test Pipeline failed
ci/woodpecker/pr/test Pipeline was successful
This commit is contained in:
parent
838b025337
commit
e71a7893ec
|
@ -86,7 +86,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do
|
||||||
%{"source" => %{"mediaType" => "text/x.misskeymarkdown", "content" => content}} = object
|
%{"source" => %{"mediaType" => "text/x.misskeymarkdown", "content" => content}} = object
|
||||||
) do
|
) do
|
||||||
{linked, _, _} = Utils.format_input(content, "text/x.misskeymarkdown")
|
{linked, _, _} = Utils.format_input(content, "text/x.misskeymarkdown")
|
||||||
put_in(object, ["source", "content"], linked)
|
Map.put(object, "content", linked)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp fix_misskey_content(%{"_misskey_content" => content} = object) do
|
defp fix_misskey_content(%{"_misskey_content" => content} = object) do
|
||||||
|
@ -94,9 +94,10 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidator do
|
||||||
|
|
||||||
object
|
object
|
||||||
|> Map.put("source", %{
|
|> Map.put("source", %{
|
||||||
"content" => linked,
|
"content" => content,
|
||||||
"mediaType" => "text/x.misskeymarkdown"
|
"mediaType" => "text/x.misskeymarkdown"
|
||||||
})
|
})
|
||||||
|
|> Map.put("content", linked)
|
||||||
|> Map.delete("_misskey_content")
|
|> Map.delete("_misskey_content")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,11 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
|
||||||
%{
|
%{
|
||||||
valid?: true,
|
valid?: true,
|
||||||
changes: %{
|
changes: %{
|
||||||
source: %{"content" => ^expected_content, "mediaType" => "text/x.misskeymarkdown"}
|
content: ^expected_content,
|
||||||
|
source: %{
|
||||||
|
"content" => "@akkoma_user linkifylink #dancedance $[jelly mfm goes here] \n\n## aaa",
|
||||||
|
"mediaType" => "text/x.misskeymarkdown"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} = ArticleNotePageValidator.cast_and_validate(note)
|
} = ArticleNotePageValidator.cast_and_validate(note)
|
||||||
end
|
end
|
||||||
|
@ -107,7 +111,11 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
|
||||||
%{
|
%{
|
||||||
valid?: true,
|
valid?: true,
|
||||||
changes: %{
|
changes: %{
|
||||||
source: %{"content" => ^expected_content, "mediaType" => "text/x.misskeymarkdown"}
|
content: ^expected_content,
|
||||||
|
source: %{
|
||||||
|
"content" => "@akkoma_user linkifylink #dancedance $[jelly mfm goes here] \n\n## aaa",
|
||||||
|
"mediaType" => "text/x.misskeymarkdown"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} = ArticleNotePageValidator.cast_and_validate(note)
|
} = ArticleNotePageValidator.cast_and_validate(note)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue