Merge branch 'fix/inconsistent-reference' into 'develop'
MastoAPI Status View: make consistently named object references See merge request pleroma/pleroma!3358
This commit is contained in:
commit
37c37090fa
@ -124,16 +124,16 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||||||
) do
|
) do
|
||||||
user = CommonAPI.get_user(activity.data["actor"])
|
user = CommonAPI.get_user(activity.data["actor"])
|
||||||
created_at = Utils.to_masto_date(activity.data["published"])
|
created_at = Utils.to_masto_date(activity.data["published"])
|
||||||
activity_object = Object.normalize(activity, fetch: false)
|
object = Object.normalize(activity, fetch: false)
|
||||||
|
|
||||||
reblogged_parent_activity =
|
reblogged_parent_activity =
|
||||||
if opts[:parent_activities] do
|
if opts[:parent_activities] do
|
||||||
Activity.Queries.find_by_object_ap_id(
|
Activity.Queries.find_by_object_ap_id(
|
||||||
opts[:parent_activities],
|
opts[:parent_activities],
|
||||||
activity_object.data["id"]
|
object.data["id"]
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
Activity.create_by_object_ap_id(activity_object.data["id"])
|
Activity.create_by_object_ap_id(object.data["id"])
|
||||||
|> Activity.with_preloaded_bookmark(opts[:for])
|
|> Activity.with_preloaded_bookmark(opts[:for])
|
||||||
|> Activity.with_set_thread_muted_field(opts[:for])
|
|> Activity.with_set_thread_muted_field(opts[:for])
|
||||||
|> Repo.one()
|
|> Repo.one()
|
||||||
@ -142,7 +142,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||||||
reblog_rendering_opts = Map.put(opts, :activity, reblogged_parent_activity)
|
reblog_rendering_opts = Map.put(opts, :activity, reblogged_parent_activity)
|
||||||
reblogged = render("show.json", reblog_rendering_opts)
|
reblogged = render("show.json", reblog_rendering_opts)
|
||||||
|
|
||||||
favorited = opts[:for] && opts[:for].ap_id in (activity_object.data["likes"] || [])
|
favorited = opts[:for] && opts[:for].ap_id in (object.data["likes"] || [])
|
||||||
|
|
||||||
bookmarked = Activity.get_bookmark(reblogged_parent_activity, opts[:for]) != nil
|
bookmarked = Activity.get_bookmark(reblogged_parent_activity, opts[:for]) != nil
|
||||||
|
|
||||||
@ -154,8 +154,8 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||||||
|
|
||||||
%{
|
%{
|
||||||
id: to_string(activity.id),
|
id: to_string(activity.id),
|
||||||
uri: activity_object.data["id"],
|
uri: object.data["id"],
|
||||||
url: activity_object.data["id"],
|
url: object.data["id"],
|
||||||
account:
|
account:
|
||||||
AccountView.render("show.json", %{
|
AccountView.render("show.json", %{
|
||||||
user: user,
|
user: user,
|
||||||
@ -180,7 +180,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||||||
media_attachments: reblogged[:media_attachments] || [],
|
media_attachments: reblogged[:media_attachments] || [],
|
||||||
mentions: mentions,
|
mentions: mentions,
|
||||||
tags: reblogged[:tags] || [],
|
tags: reblogged[:tags] || [],
|
||||||
application: build_application(activity_object.data["generator"]),
|
application: build_application(object.data["generator"]),
|
||||||
language: nil,
|
language: nil,
|
||||||
emojis: [],
|
emojis: [],
|
||||||
pleroma: %{
|
pleroma: %{
|
||||||
|
Loading…
Reference in New Issue
Block a user