Merge branch 'fix/normalize-activities' into 'develop'
Normalize acitvities instead of objects inside them See merge request pleroma/pleroma!1085
This commit is contained in:
commit
aa9d378985
|
@ -76,7 +76,7 @@ def render_activities(activities) 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 @@ def fetch_object_from_id(id) 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 @@ def stream_out(activity) 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 @@ def make_note_data(
|
|||
}
|
||||
|
||||
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 @@ defp get_replied_to_activities(activities) 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 @@ def render("attachment.json", %{attachment: attachment}) 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 @@ def to_simple_form(activity, user, with_author \\ false)
|
|||
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 New Issue