fix the status notification with special char
authorSachin Joshi <satchin.joshi@gmail.com>
Wed, 24 Apr 2019 01:21:17 +0000 (07:06 +0545)
committerSachin Joshi <satchin.joshi@gmail.com>
Wed, 24 Apr 2019 01:21:17 +0000 (07:06 +0545)
lib/pleroma/web/twitter_api/views/activity_view.ex
test/web/twitter_api/views/activity_view_test.exs

index c64152da8f844cde4f5e70dfdee7fba3bb7af7bf..1007a2a48de577a19cf5ed7957da7a4ce19d68ef 100644 (file)
@@ -289,7 +289,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
       "uri" => object.data["id"],
       "user" => UserView.render("show.json", %{user: user, for: opts[:for]}),
       "statusnet_html" => html,
-      "text" => text,
+      "text" => HtmlEntities.decode(text),
       "is_local" => activity.local,
       "is_post_verb" => true,
       "created_at" => created_at,
index d84ab74208fd5910fb344a17df13d0ee9af03d83..85815ba7e98a8028409fe84abdec421b0cb37718 100644 (file)
@@ -371,4 +371,14 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
     assert length(result["attachments"]) == 1
     assert result["summary"] == "Friday Night"
   end
+
+  test "special characters are not escaped in text field for status created" do
+    text = "<3 is on the way"
+
+    {:ok, activity} = CommonAPI.post(insert(:user), %{"status" => text})
+
+    result = ActivityView.render("activity.json", activity: activity)
+
+    assert result["text"] == text
+  end
 end