def home_timeline(%{assigns: %{user: user}} = conn, params) do
params = params
|> Map.put("type", ["Create", "Announce"])
+ |> Map.put("blocking_user", user)
activities = ActivityPub.fetch_activities([user.ap_id | user.following], params)
|> Enum.reverse
params = params
|> Map.put("type", ["Create", "Announce"])
|> Map.put("local_only", !!params["local"])
+ |> Map.put("blocking_user", user)
activities = ActivityPub.fetch_public_activities(params)
|> Enum.reverse
def get_context(%{assigns: %{user: user}} = conn, %{"id" => id}) do
with %Activity{} = activity <- Repo.get(Activity, id),
- activities <- ActivityPub.fetch_activities_for_context(activity.data["object"]["context"]),
+ activities <- ActivityPub.fetch_activities_for_context(activity.data["object"]["context"], %{"blocking_user" => user}),
activities <- activities |> Enum.filter(fn (%{id: aid}) -> to_string(aid) != to_string(id) end),
grouped_activities <- Enum.group_by(activities, fn (%{id: id}) -> id < activity.id end) do
result = %{
params = params
|> Map.put("type", "Create")
|> Map.put("local_only", !!params["local"])
+ |> Map.put("blocking_user", user)
activities = ActivityPub.fetch_public_activities(params)
|> Enum.reverse
params = conn
|> Map.put("type", "Create")
|> Map.put("favorited_by", user.ap_id)
+ |> Map.put("blocking_user", user)
activities = ActivityPub.fetch_activities([], params)
|> Enum.reverse