MastoAPI AccountView: fill source.note with plaintext version of note
authorHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Wed, 22 May 2019 05:22:19 +0000 (07:22 +0200)
committerHaelwenn (lanodan) Monnier <contact@hacktivis.me>
Wed, 22 May 2019 05:22:19 +0000 (07:22 +0200)
Closes: https://git.pleroma.social/pleroma/pleroma/issues/926
lib/pleroma/web/mastodon_api/views/account_view.ex
test/web/mastodon_api/account_view_test.exs

index 134c07b7eb57228e2b8b6bbfda16b9f4bae2a915..b82d3319b4c4d40da6ef356ed61eb2b0e00dca91 100644 (file)
@@ -112,7 +112,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountView do
       fields: fields,
       bot: bot,
       source: %{
-        note: "",
+        note: HTML.strip_tags((user.bio || "") |> String.replace("<br>", "\n")),
         sensitive: false,
         pleroma: %{}
       },
index a24f2a050ff7702a93427340443865de971b29a0..aaf2261bbd2f6f98e76c73fca2edd744a2bbca13 100644 (file)
@@ -55,7 +55,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
       fields: [],
       bot: false,
       source: %{
-        note: "",
+        note: "valid html",
         sensitive: false,
         pleroma: %{}
       },
@@ -120,7 +120,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
       fields: [],
       bot: true,
       source: %{
-        note: "",
+        note: user.bio,
         sensitive: false,
         pleroma: %{}
       },
@@ -209,7 +209,7 @@ defmodule Pleroma.Web.MastodonAPI.AccountViewTest do
       fields: [],
       bot: true,
       source: %{
-        note: "",
+        note: user.bio,
         sensitive: false,
         pleroma: %{}
       },