Commit e1b0ccce authored by lain's avatar lain

Mastodon API context fix.

parent e9de04b7
Pipeline #847 failed with stage
in 2 minutes and 19 seconds
...@@ -202,7 +202,7 @@ def get_status(%{assigns: %{user: user}} = conn, %{"id" => id}) do ...@@ -202,7 +202,7 @@ def get_status(%{assigns: %{user: user}} = conn, %{"id" => id}) do
def get_context(%{assigns: %{user: user}} = conn, %{"id" => id}) do def get_context(%{assigns: %{user: user}} = conn, %{"id" => id}) do
with %Activity{} = activity <- Repo.get(Activity, id), with %Activity{} = activity <- Repo.get(Activity, id),
activities <- ActivityPub.fetch_activities_for_context(activity.data["object"]["context"], %{"blocking_user" => user, "user" => user}), activities <- ActivityPub.fetch_activities_for_context(activity.data["context"], %{"blocking_user" => user, "user" => user}),
activities <- activities |> Enum.filter(fn (%{id: aid}) -> to_string(aid) != to_string(id) end), activities <- activities |> Enum.filter(fn (%{id: aid}) -> to_string(aid) != to_string(id) end),
activities <- activities |> Enum.filter(fn (%{data: %{"type" => type}}) -> type == "Create" end), activities <- activities |> Enum.filter(fn (%{data: %{"type" => type}}) -> type == "Create" end),
grouped_activities <- Enum.group_by(activities, fn (%{id: id}) -> id < activity.id end) do grouped_activities <- Enum.group_by(activities, fn (%{id: id}) -> id < activity.id end) do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment