forked from mirrors/akkoma
TwitterAPI: Include favorited post in json
This commit is contained in:
parent
b19ee62252
commit
61ad2ce422
2 changed files with 9 additions and 0 deletions
|
@ -190,6 +190,11 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
|
||||||
|
|
||||||
text = "#{user.nickname} favorited a status."
|
text = "#{user.nickname} favorited a status."
|
||||||
|
|
||||||
|
favorited_status =
|
||||||
|
if liked_activity,
|
||||||
|
do: render("activity.json", Map.merge(opts, %{activity: liked_activity})),
|
||||||
|
else: nil
|
||||||
|
|
||||||
%{
|
%{
|
||||||
"id" => activity.id,
|
"id" => activity.id,
|
||||||
"user" => UserView.render("show.json", %{user: user, for: opts[:for]}),
|
"user" => UserView.render("show.json", %{user: user, for: opts[:for]}),
|
||||||
|
@ -199,6 +204,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityView do
|
||||||
"is_post_verb" => false,
|
"is_post_verb" => false,
|
||||||
"uri" => "tag:#{activity.data["id"]}:objectType=Favourite",
|
"uri" => "tag:#{activity.data["id"]}:objectType=Favourite",
|
||||||
"created_at" => created_at,
|
"created_at" => created_at,
|
||||||
|
"favorited_status" => favorited_status,
|
||||||
"in_reply_to_status_id" => liked_activity_id,
|
"in_reply_to_status_id" => liked_activity_id,
|
||||||
"external_url" => activity.data["id"],
|
"external_url" => activity.data["id"],
|
||||||
"activity_type" => "like"
|
"activity_type" => "like"
|
||||||
|
|
|
@ -112,6 +112,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
|
||||||
{:ok, like, _object} = CommonAPI.favorite(activity.id, other_user)
|
{:ok, like, _object} = CommonAPI.favorite(activity.id, other_user)
|
||||||
|
|
||||||
result = ActivityView.render("activity.json", activity: like)
|
result = ActivityView.render("activity.json", activity: like)
|
||||||
|
activity = Pleroma.Activity.get_by_ap_id(activity.data["id"])
|
||||||
|
|
||||||
expected = %{
|
expected = %{
|
||||||
"activity_type" => "like",
|
"activity_type" => "like",
|
||||||
|
@ -121,6 +122,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
|
||||||
"in_reply_to_status_id" => activity.id,
|
"in_reply_to_status_id" => activity.id,
|
||||||
"is_local" => true,
|
"is_local" => true,
|
||||||
"is_post_verb" => false,
|
"is_post_verb" => false,
|
||||||
|
"favorited_status" => ActivityView.render("activity.json", activity: activity),
|
||||||
"statusnet_html" => "shp favorited a status.",
|
"statusnet_html" => "shp favorited a status.",
|
||||||
"text" => "shp favorited a status.",
|
"text" => "shp favorited a status.",
|
||||||
"uri" => "tag:#{like.data["id"]}:objectType=Favourite",
|
"uri" => "tag:#{like.data["id"]}:objectType=Favourite",
|
||||||
|
@ -148,6 +150,7 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
|
||||||
"in_reply_to_status_id" => nil,
|
"in_reply_to_status_id" => nil,
|
||||||
"is_local" => true,
|
"is_local" => true,
|
||||||
"is_post_verb" => false,
|
"is_post_verb" => false,
|
||||||
|
"favorited_status" => nil,
|
||||||
"statusnet_html" => "shp favorited a status.",
|
"statusnet_html" => "shp favorited a status.",
|
||||||
"text" => "shp favorited a status.",
|
"text" => "shp favorited a status.",
|
||||||
"uri" => "tag:#{like.data["id"]}:objectType=Favourite",
|
"uri" => "tag:#{like.data["id"]}:objectType=Favourite",
|
||||||
|
|
Loading…
Reference in a new issue