end
def fetch_friend_statuses(user, opts \\ %{}) do
- opts = Map.put(opts, "blocking_user", user)
+ opts = opts
+ |> Map.put("blocking_user", user)
+ |> Map.put("user", user)
+ |> Map.put("type", ["Create", "Announce", "Follow"])
+
ActivityPub.fetch_activities([user.ap_id | user.following], opts)
|> activities_to_statuses(%{for: user})
end
def fetch_public_statuses(user, opts \\ %{}) do
- opts = Map.put(opts, "local_only", true)
- opts = Map.put(opts, "blocking_user", user)
+ opts = opts
+ |> Map.put("local_only", true)
+ |> Map.put("blocking_user", user)
+ |> Map.put("type", ["Create", "Announce", "Follow"])
+
ActivityPub.fetch_public_activities(opts)
|> activities_to_statuses(%{for: user})
end
def fetch_public_and_external_statuses(user, opts \\ %{}) do
- opts = Map.put(opts, "blocking_user", user)
+ opts = opts
+ |> Map.put("blocking_user", user)
+ |> Map.put("type", ["Create", "Announce", "Follow"])
+
ActivityPub.fetch_public_activities(opts)
|> activities_to_statuses(%{for: user})
end
def fetch_user_statuses(user, opts \\ %{}) do
ActivityPub.fetch_activities([], opts)
+ |> Map.put("type", ["Create", "Announce", "Follow"])
|> activities_to_statuses(%{for: user})
end
def fetch_conversation(user, id) do
with context when is_binary(context) <- conversation_id_to_context(id),
- activities <- ActivityPub.fetch_activities_for_context(context, %{"blocking_user" => user}),
+ activities <- ActivityPub.fetch_activities_for_context(context, %{"blocking_user" => user, "user" => user}),
statuses <- activities |> activities_to_statuses(%{for: user})
do
statuses
end
def fetch_status(user, id) do
- with %Activity{} = activity <- Repo.get(Activity, id) do
+ with %Activity{} = activity <- Repo.get(Activity, id),
+ true <- ActivityPub.visible_for_user?(activity, user) do
activity_to_status(activity, %{for: user})
end
end