aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/twitter_api/representers
diff options
context:
space:
mode:
authorRoger Braun <roger@rogerbraun.net>2017-05-05 11:46:59 +0200
committerRoger Braun <roger@rogerbraun.net>2017-05-05 11:46:59 +0200
commitc48c381e909240dcece9f961e4728fa712d089cc (patch)
tree6aa2a1edbfe5d15860ab5090c645bc9ba312ab96 /lib/pleroma/web/twitter_api/representers
parent6cf7c132282e612514af992c6dea0b03ee5b678d (diff)
parentc85998ab8a21f042ab57345a7baa9e1e27c308d1 (diff)
downloadpleroma-c48c381e909240dcece9f961e4728fa712d089cc.tar.gz
Merge branch 'develop' into dtluna/pleroma-refactor/1
Diffstat (limited to 'lib/pleroma/web/twitter_api/representers')
-rw-r--r--lib/pleroma/web/twitter_api/representers/activity_representer.ex9
-rw-r--r--lib/pleroma/web/twitter_api/representers/user_representer.ex5
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/pleroma/web/twitter_api/representers/activity_representer.ex b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
index b58572829..4d7ea0c5c 100644
--- a/lib/pleroma/web/twitter_api/representers/activity_representer.ex
+++ b/lib/pleroma/web/twitter_api/representers/activity_representer.ex
@@ -3,6 +3,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
alias Pleroma.Web.TwitterAPI.Representers.{UserRepresenter, ObjectRepresenter}
alias Pleroma.{Activity, User}
alias Calendar.Strftime
+ alias Pleroma.Web.TwitterAPI.TwitterAPI
defp user_by_ap_id(user_list, ap_id) do
Enum.find(user_list, fn (%{ap_id: user_id}) -> ap_id == user_id end)
@@ -81,6 +82,12 @@ 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
+
%{
"id" => activity.id,
"user" => UserRepresenter.to_map(user, opts),
@@ -91,7 +98,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.ActivityRepresenter do
"is_post_verb" => true,
"created_at" => created_at,
"in_reply_to_status_id" => object["inReplyToStatusId"],
- "statusnet_conversation_id" => object["statusnetConversationId"],
+ "statusnet_conversation_id" => conversation_id,
"attachments" => (object["attachment"] || []) |> ObjectRepresenter.enum_to_list(opts),
"attentions" => attentions,
"fave_num" => like_count,
diff --git a/lib/pleroma/web/twitter_api/representers/user_representer.ex b/lib/pleroma/web/twitter_api/representers/user_representer.ex
index ab7d6d353..493077413 100644
--- a/lib/pleroma/web/twitter_api/representers/user_representer.ex
+++ b/lib/pleroma/web/twitter_api/representers/user_representer.ex
@@ -11,7 +11,7 @@ defmodule Pleroma.Web.TwitterAPI.Representers.UserRepresenter do
false
end
- user_info = User.user_info(user)
+ user_info = User.get_cached_user_info(user)
map = %{
"id" => user.id,
@@ -28,7 +28,8 @@ defmodule Pleroma.Web.TwitterAPI.Representers.UserRepresenter do
"profile_image_url_https" => image,
"profile_image_url_profile_size" => image,
"profile_image_url_original" => image,
- "rights" => %{}
+ "rights" => %{},
+ "statusnet_profile_url" => user.ap_id
}
map