Move finmojis to representation.
[akkoma] / lib / pleroma / web / twitter_api / representers / activity_representer.ex
index 6b189b3c08f19853074eedb3a036f85895e9e285..8630f4f79c3f1e2271624cce21268730c33fe6bd 100644 (file)
@@ -4,7 +4,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
   alias Pleroma.{Activity, User}
   alias Calendar.Strftime
   alias Pleroma.Web.TwitterAPI.TwitterAPI
-  alias Pleroma.Wi
+  alias Pleroma.Formatter
 
   defp user_by_ap_id(user_list, ap_id) do
     Enum.find(user_list, fn (%{ap_id: user_id}) -> ap_id == user_id end)
@@ -93,7 +93,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
       "id" => activity.id,
       "user" => UserRepresenter.to_map(user, opts),
       "attentions" => [],
-      "statusnet_html" => content,
+      "statusnet_html" => HtmlSanitizeEx.basic_html(content) |> Formatter.finmojifiy,
       "text" => HtmlSanitizeEx.strip_tags(content),
       "is_local" => true,
       "is_post_verb" => true,
@@ -106,7 +106,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
       "repeat_num" => announcement_count,
       "favorited" => to_boolean(favorited),
       "repeated" => to_boolean(repeated),
-      "external_url" => activity.data["id"]
+      "external_url" => activity.data["id"],
+      "tags" => activity.data["object"]["tag"] || []
     }
   end
 
@@ -117,14 +118,6 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
     end
   end
 
-  defp date_to_asctime(date) do
-    with {:ok, date, _offset} <- date |> DateTime.from_iso8601 do
-      Strftime.strftime!(date, "%a %b %d %H:%M:%S %z %Y")
-    else _e ->
-      ""
-    end
-  end
-
   defp to_boolean(false) do
     false
   end