mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-19 19:54:38 +00:00
TwitterAPI: Add blocking to fetches.
This commit is contained in:
parent
867ac1e4f5
commit
d89a7a0b34
1 changed files with 4 additions and 1 deletions
|
@ -14,17 +14,20 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_friend_statuses(user, opts \\ %{}) do
|
def fetch_friend_statuses(user, opts \\ %{}) do
|
||||||
|
opts = Map.put(opts, "blocking_user", user)
|
||||||
ActivityPub.fetch_activities([user.ap_id | user.following], opts)
|
ActivityPub.fetch_activities([user.ap_id | user.following], opts)
|
||||||
|> activities_to_statuses(%{for: user})
|
|> activities_to_statuses(%{for: user})
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_public_statuses(user, opts \\ %{}) do
|
def fetch_public_statuses(user, opts \\ %{}) do
|
||||||
opts = Map.put(opts, "local_only", true)
|
opts = Map.put(opts, "local_only", true)
|
||||||
|
opts = Map.put(opts, "blocking_user", user)
|
||||||
ActivityPub.fetch_public_activities(opts)
|
ActivityPub.fetch_public_activities(opts)
|
||||||
|> activities_to_statuses(%{for: user})
|
|> activities_to_statuses(%{for: user})
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_public_and_external_statuses(user, opts \\ %{}) do
|
def fetch_public_and_external_statuses(user, opts \\ %{}) do
|
||||||
|
opts = Map.put(opts, "blocking_user", user)
|
||||||
ActivityPub.fetch_public_activities(opts)
|
ActivityPub.fetch_public_activities(opts)
|
||||||
|> activities_to_statuses(%{for: user})
|
|> activities_to_statuses(%{for: user})
|
||||||
end
|
end
|
||||||
|
@ -41,7 +44,7 @@ defmodule Pleroma.Web.TwitterAPI.TwitterAPI do
|
||||||
|
|
||||||
def fetch_conversation(user, id) do
|
def fetch_conversation(user, id) do
|
||||||
with context when is_binary(context) <- conversation_id_to_context(id),
|
with context when is_binary(context) <- conversation_id_to_context(id),
|
||||||
activities <- ActivityPub.fetch_activities_for_context(context),
|
activities <- ActivityPub.fetch_activities_for_context(context, %{"blocking_user" => user}),
|
||||||
statuses <- activities |> activities_to_statuses(%{for: user})
|
statuses <- activities |> activities_to_statuses(%{for: user})
|
||||||
do
|
do
|
||||||
statuses
|
statuses
|
||||||
|
|
Loading…
Reference in a new issue