mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-08 17:49:22 +00:00
Replace Object.normalize(activity.data[object] with Object.normalize(acitivty) to benefit from preloading
This commit is contained in:
parent
20deff75f1
commit
d21d921def
6 changed files with 7 additions and 7 deletions
|
@ -76,7 +76,7 @@ defmodule Pleroma.Gopher.Server.ProtocolHandler do
|
|||
|> Enum.map(fn activity ->
|
||||
user = User.get_cached_by_ap_id(activity.data["actor"])
|
||||
|
||||
object = Object.normalize(activity.data["object"])
|
||||
object = Object.normalize(activity)
|
||||
like_count = object["like_count"] || 0
|
||||
announcement_count = object["announcement_count"] || 0
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ defmodule Pleroma.Object.Fetcher do
|
|||
Logger.info("Couldn't get object via AP, trying out OStatus fetching...")
|
||||
|
||||
case OStatus.fetch_activity_from_url(id) do
|
||||
{:ok, [activity | _]} -> {:ok, Object.normalize(activity.data["object"], false)}
|
||||
{:ok, [activity | _]} -> {:ok, Object.normalize(activity, false)}
|
||||
e -> e
|
||||
end
|
||||
end
|
||||
|
|
|
@ -168,7 +168,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPub do
|
|||
public = "https://www.w3.org/ns/activitystreams#Public"
|
||||
|
||||
if activity.data["type"] in ["Create", "Announce", "Delete"] do
|
||||
object = Object.normalize(activity.data["object"])
|
||||
object = Object.normalize(activity)
|
||||
Pleroma.Web.Streamer.stream("user", activity)
|
||||
Pleroma.Web.Streamer.stream("list", activity)
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ defmodule Pleroma.Web.CommonAPI.Utils do
|
|||
}
|
||||
|
||||
if in_reply_to do
|
||||
in_reply_to_object = Object.normalize(in_reply_to.data["object"])
|
||||
in_reply_to_object = Object.normalize(in_reply_to)
|
||||
|
||||
object
|
||||
|> Map.put("inReplyTo", in_reply_to_object.data["id"])
|
||||
|
|
|
@ -31,7 +31,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||
|> Activity.create_by_object_ap_id()
|
||||
|> Repo.all()
|
||||
|> Enum.reduce(%{}, fn activity, acc ->
|
||||
object = Object.normalize(activity.data["object"])
|
||||
object = Object.normalize(activity)
|
||||
Map.put(acc, object.data["id"], activity)
|
||||
end)
|
||||
end
|
||||
|
@ -316,7 +316,7 @@ defmodule Pleroma.Web.MastodonAPI.StatusView do
|
|||
end
|
||||
|
||||
def get_reply_to(activity, %{replied_to_activities: replied_to_activities}) do
|
||||
object = Object.normalize(activity.data["object"])
|
||||
object = Object.normalize(activity)
|
||||
|
||||
with nil <- replied_to_activities[object.data["inReplyTo"]] do
|
||||
# If user didn't participate in the thread
|
||||
|
|
|
@ -84,7 +84,7 @@ defmodule Pleroma.Web.OStatus.ActivityRepresenter do
|
|||
def to_simple_form(%{data: %{"type" => "Create"}} = activity, user, with_author) do
|
||||
h = fn str -> [to_charlist(str)] end
|
||||
|
||||
object = Object.normalize(activity.data["object"])
|
||||
object = Object.normalize(activity)
|
||||
|
||||
updated_at = object.data["published"]
|
||||
inserted_at = object.data["published"]
|
||||
|
|
Loading…
Reference in a new issue