forked from AkkomaGang/akkoma
MastoAPI: Return reblogs, too.
This commit is contained in:
parent
62ca2617cd
commit
260f09dd6c
2 changed files with 10 additions and 4 deletions
|
@ -141,9 +141,12 @@ defp restrict_actor(query, %{"actor_id" => actor_id}) do
|
|||
end
|
||||
defp restrict_actor(query, _), do: query
|
||||
|
||||
defp restrict_type(query, %{"type" => type}) when is_binary(type) do
|
||||
restrict_type(query, %{"type" => [type]})
|
||||
end
|
||||
defp restrict_type(query, %{"type" => type}) do
|
||||
from activity in query,
|
||||
where: fragment("?->>'type' = ?", activity.data, ^type)
|
||||
where: fragment("?->>'type' = ANY(?)", activity.data, ^type)
|
||||
end
|
||||
defp restrict_type(query, _), do: query
|
||||
|
||||
|
|
|
@ -77,7 +77,10 @@ defp add_link_headers(conn, method, activities) do
|
|||
end
|
||||
|
||||
def home_timeline(%{assigns: %{user: user}} = conn, params) do
|
||||
activities = ActivityPub.fetch_activities([user.ap_id | user.following], Map.put(params, "type", "Create"))
|
||||
params = params
|
||||
|> Map.put("type", ["Create", "Announce"])
|
||||
|
||||
activities = ActivityPub.fetch_activities([user.ap_id | user.following], params)
|
||||
|> Enum.reverse
|
||||
|
||||
conn
|
||||
|
@ -87,7 +90,7 @@ def home_timeline(%{assigns: %{user: user}} = conn, params) do
|
|||
|
||||
def public_timeline(%{assigns: %{user: user}} = conn, params) do
|
||||
params = params
|
||||
|> Map.put("type", "Create")
|
||||
|> Map.put("type", ["Create", "Announce"])
|
||||
|> Map.put("local_only", !!params["local"])
|
||||
|
||||
activities = ActivityPub.fetch_public_activities(params)
|
||||
|
@ -102,7 +105,7 @@ def public_timeline(%{assigns: %{user: user}} = conn, params) do
|
|||
def user_statuses(%{assigns: %{user: user}} = conn, params) do
|
||||
with %User{ap_id: ap_id} <- Repo.get(User, params["id"]) do
|
||||
params = params
|
||||
|> Map.put("type", "Create")
|
||||
|> Map.put("type", ["Create", "Announce"])
|
||||
|> Map.put("actor_id", ap_id)
|
||||
|
||||
activities = ActivityPub.fetch_activities([], params)
|
||||
|
|
Loading…
Reference in a new issue