aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/twitter_api/representers/activity_representer.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pleroma/web/twitter_api/representers/activity_representer.ex')
-rw-r--r--lib/pleroma/web/twitter_api/representers/activity_representer.ex19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/pleroma/web/twitter_api/representers/activity_representer.ex b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
index 6a5304049..ed8655905 100644
--- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex
+++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
@@ -4,6 +4,25 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
alias Pleroma.Activity
+ def to_map(%Activity{data: %{"type" => "Like"}} = activity, %{user: user, liked_activity: liked_activity} = opts) do
+ created_at = get_in(activity.data, ["published"])
+ |> date_to_asctime
+
+ text = "#{user.nickname} favorited a status."
+
+ %{
+ "id" => activity.id,
+ "user" => UserRepresenter.to_map(user, opts),
+ "statusnet_html" => text, # TODO: add summary
+ "text" => text,
+ "is_local" => true,
+ "is_post_verb" => false,
+ "uri" => "tag:#{activity.data["id"]}:objectType=Favourite",
+ "created_at" => created_at,
+ "in_reply_to_status_id" => liked_activity.id,
+ }
+ end
+
def to_map(%Activity{data: %{"type" => "Follow"}} = activity, %{user: user} = opts) do
created_at = get_in(activity.data, ["published"])
|> date_to_asctime