Don't return html in the text field.

This commit is contained in:
Roger Braun 2017-04-12 17:22:29 +02:00
parent b666f11d2f
commit 1b086834bd
2 changed files with 5 additions and 4 deletions

View file

@ -33,7 +33,7 @@ def to_map(%Activity{} = activity, %{user: user} = opts) do
"user" => UserRepresenter.to_map(user, opts), "user" => UserRepresenter.to_map(user, opts),
"attentions" => [], "attentions" => [],
"statusnet_html" => content, "statusnet_html" => content,
"text" => content, "text" => HtmlSanitizeEx.strip_tags(content),
"is_local" => true, "is_local" => true,
"is_post_verb" => true, "is_post_verb" => true,
"created_at" => published, "created_at" => published,

View file

@ -23,7 +23,8 @@ test "an activity" do
} }
} }
content = "Some content mentioning @shp" content_html = "Some content mentioning <a href='shp'>@shp</shp>"
content = HtmlSanitizeEx.strip_tags(content_html)
date = DateTime.utc_now() |> DateTime.to_iso8601 date = DateTime.utc_now() |> DateTime.to_iso8601
activity = %Activity{ activity = %Activity{
@ -39,7 +40,7 @@ test "an activity" do
"object" => %{ "object" => %{
"published" => date, "published" => date,
"type" => "Note", "type" => "Note",
"content" => content, "content" => content_html,
"inReplyToStatusId" => 213123, "inReplyToStatusId" => 213123,
"statusnetConversationId" => 4711, "statusnetConversationId" => 4711,
"attachment" => [ "attachment" => [
@ -56,7 +57,7 @@ test "an activity" do
"user" => UserRepresenter.to_map(user, %{for: follower}), "user" => UserRepresenter.to_map(user, %{for: follower}),
"is_local" => true, "is_local" => true,
"attentions" => [], "attentions" => [],
"statusnet_html" => content, "statusnet_html" => content_html,
"text" => content, "text" => content,
"is_post_verb" => true, "is_post_verb" => true,
"created_at" => date, "created_at" => date,