diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-07-08 11:17:35 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-07-08 11:17:35 +0200 |
commit | 7e9647b146a6b48ed32383f8379db5bf2a22277c (patch) | |
tree | a725b1250d8d97aaea799f5e7ae2bff80ba95bb6 /lib | |
parent | e343c0c9c42968316c93ebb52a570ccd5778acb0 (diff) | |
download | pleroma-7e9647b146a6b48ed32383f8379db5bf2a22277c.tar.gz |
Fix undo activity.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/twitter_api/representers/activity_representer.ex | 20 |
1 files changed, 20 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 a03b34ffb..10aab919a 100644 --- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex +++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex @@ -72,6 +72,26 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do } end + # TODO: + # Make this more proper. Just a placeholder to not break the frontend. + def to_map(%Activity{data: %{"type" => "Undo", "published" => created_at, "object" => undid_activity }} = activity, %{user: user} = opts) do + created_at = created_at |> Utils.date_to_asctime + + text = "#{user.nickname} undid the action at #{undid_activity}" + %{ + "id" => activity.id, + "user" => UserView.render("show.json", %{user: user, for: opts[:for]}), + "attentions" => [], + "statusnet_html" => text, + "text" => text, + "is_local" => activity.local, + "is_post_verb" => false, + "created_at" => created_at, + "in_reply_to_status_id" => nil, + "external_url" => activity.data["id"] + } + end + def to_map(%Activity{data: %{"object" => %{"content" => content} = object}} = activity, %{user: user} = opts) do created_at = object["published"] |> Utils.date_to_asctime like_count = object["like_count"] || 0 |