Remove html from user bios on display.

This is mainly to fix problems of bios coming from mastodong.
This commit is contained in:
Roger Braun 2017-06-18 13:17:35 +02:00
parent cde5d6b71c
commit 7b41e103e1
2 changed files with 4 additions and 4 deletions

View file

@ -18,7 +18,7 @@ def to_map(user, opts) do
"id" => user.id, "id" => user.id,
"name" => user.name, "name" => user.name,
"screen_name" => user.nickname, "screen_name" => user.nickname,
"description" => user.bio, "description" => HtmlSanitizeEx.strip_tags(user.bio),
"following" => following, "following" => following,
"created_at" => created_at, "created_at" => created_at,
# Fake fields # Fake fields

View file

@ -8,7 +8,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.UserRepresenterTest do
import Pleroma.Factory import Pleroma.Factory
setup do setup do
user = insert(:user) user = insert(:user, bio: "<span>Here's some html</span>")
[user: user] [user: user]
end end
@ -39,7 +39,7 @@ test "A user" do
"id" => user.id, "id" => user.id,
"name" => user.name, "name" => user.name,
"screen_name" => user.nickname, "screen_name" => user.nickname,
"description" => user.bio, "description" => HtmlSanitizeEx.strip_tags(user.bio),
"created_at" => created_at, "created_at" => created_at,
# Fake fields # Fake fields
"favourites_count" => 0, "favourites_count" => 0,
@ -66,7 +66,7 @@ test "A user for a given other follower", %{user: user} do
"id" => user.id, "id" => user.id,
"name" => user.name, "name" => user.name,
"screen_name" => user.nickname, "screen_name" => user.nickname,
"description" => user.bio, "description" => HtmlSanitizeEx.strip_tags(user.bio),
"created_at" => created_at, "created_at" => created_at,
# Fake fields # Fake fields
"favourites_count" => 0, "favourites_count" => 0,