aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-05-07 12:46:21 +0200
committerRoger Braun <roger@rogerbraun.net>2017-05-07 12:46:21 +0200
commit95ab0dc3c5ea63048a98b5fb594d0163249be822 (patch)
tree89a798ce4f534aeb184d3dd821f3ddffebc53772 /lib
parentc51e15975a2ca3c948098efa1aee6fc97335d198 (diff)
downloadpleroma-95ab0dc3c5ea63048a98b5fb594d0163249be822.tar.gz
Add conversation ids to twapi announce representer.
Diffstat (limited to 'lib')
-rw-r--r--lib/pleroma/web/twitter_api/representers/activity_representer.ex16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/pleroma/web/twitter_api/representers/activity_representer.ex b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
index 4d7ea0c5c..3fef8eec8 100644
--- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex
+++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
@@ -27,7 +27,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
"is_post_verb" => false,
"uri" => "tag:#{activity.data["id"]}:objectType=note",
"created_at" => created_at,
- "retweeted_status" => retweeted_status
+ "retweeted_status" => retweeted_status,
+ "statusnet_conversation_id" => conversation_id(announced_activity)
}
end
@@ -82,11 +83,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
|> Enum.filter(&(&1))
|> Enum.map(fn (user) -> UserRepresenter.to_map(user, opts) end)
-
- conversation_id = with context when not is_nil(context) <- activity.data["context"] do
- TwitterAPI.context_to_conversation_id(context)
- else _e -> nil
- end
+ conversation_id = conversation_id(activity)
%{
"id" => activity.id,
@@ -108,6 +105,13 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
}
end
+ def conversation_id(activity) do
+ with context when not is_nil(context) <- activity.data["context"] do
+ TwitterAPI.context_to_conversation_id(context)
+ else _e -> nil
+ 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")