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:
kaniini 2019-04-23 02:43:26 +00:00
commit aa9d378985
6 changed files with 7 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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"])

View File

@ -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

View File

@ -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"]