diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-09-04 20:48:29 +0200 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-09-04 20:48:29 +0200 |
commit | 632e1f7943b8736d2f4084bfcb347c448eac7252 (patch) | |
tree | 5fb62ba9f4ce108a08155ff4d270aab5de313d9e /lib | |
parent | 1f9a5272e18ecd90f23442ae0325b2e9fc3d1d96 (diff) | |
download | pleroma-632e1f7943b8736d2f4084bfcb347c448eac7252.tar.gz |
Add delete to TwAPI representer correctly.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/twitter_api/representers/activity_representer.ex | 4 | ||||
-rw-r--r-- | lib/pleroma/web/twitter_api/twitter_api.ex | 6 |
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/pleroma/web/twitter_api/representers/activity_representer.ex b/lib/pleroma/web/twitter_api/representers/activity_representer.ex index 321917e83..b0769de89 100644 --- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex +++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex @@ -100,7 +100,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do created_at = created_at |> Utils.date_to_asctime %{ - "id" => activity.data["object"], + "id" => activity.id, + "uri" => activity.data["object"], "user" => UserView.render("show.json", %{user: user, for: opts[:for]}), "attentions" => [], "statusnet_html" => "deleted notice {{tag", @@ -135,6 +136,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do %{ "id" => activity.id, + "uri" => activity.data["object"]["id"], "user" => UserView.render("show.json", %{user: user, for: opts[:for]}), "statusnet_html" => HtmlSanitizeEx.basic_html(content) |> Formatter.finmojifiy, "text" => HtmlSanitizeEx.strip_tags(content), diff --git a/lib/pleroma/web/twitter_api/twitter_api.ex b/lib/pleroma/web/twitter_api/twitter_api.ex index de39834ca..1ae076e24 100644 --- a/lib/pleroma/web/twitter_api/twitter_api.ex +++ b/lib/pleroma/web/twitter_api/twitter_api.ex @@ -265,6 +265,12 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do ActivityRepresenter.to_map(activity, Map.merge(opts, %{users: [user, announced_actor], announced_activity: announced_activity})) end + defp activity_to_status(%Activity{data: %{"type" => "Delete"}} = activity, opts) do + actor = get_in(activity.data, ["actor"]) + user = User.get_cached_by_ap_id(actor) + ActivityRepresenter.to_map(activity, Map.merge(opts, %{user: user})) + end + defp activity_to_status(activity, opts) do actor = get_in(activity.data, ["actor"]) user = User.get_cached_by_ap_id(actor) |