aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-09-04 20:03:28 +0200
committerRoger Braun <roger@rogerbraun.net>2017-09-04 20:03:28 +0200
commitfcf3128a5687d1ad7883772585933d8c475863db (patch)
tree53c66c14ebf051ffac56c173d1020be0fd68a929 /lib
parent2348b272e020bd22520a4306be5f2fdc8469cfd1 (diff)
downloadpleroma-fcf3128a5687d1ad7883772585933d8c475863db.tar.gz
Add TwAPI representer for deletes.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/twitter_api/representers/activity_representer.ex18
1 files changed, 18 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 bc3de0e90..321917e83 100644
--- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex
+++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
@@ -96,6 +96,24 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
}
end
+ def to_map(%Activity{data: %{"type" => "Delete", "published" => created_at, "object" => deleted_object }} = activity, %{user: user} = opts) do
+ created_at = created_at |> Utils.date_to_asctime
+
+ %{
+ "id" => activity.data["object"],
+ "user" => UserView.render("show.json", %{user: user, for: opts[:for]}),
+ "attentions" => [],
+ "statusnet_html" => "deleted notice {{tag",
+ "text" => "deleted notice {{tag" ,
+ "is_local" => activity.local,
+ "is_post_verb" => false,
+ "created_at" => created_at,
+ "in_reply_to_status_id" => nil,
+ "external_url" => activity.data["id"],
+ "activity_type" => "delete"
+ }
+ 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