mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-27 00:09:35 +00:00
Mix format
This commit is contained in:
parent
fd1fa5a2ec
commit
452980652d
|
@ -885,11 +885,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
||||||
q = from(u in User, where: u.ap_id in ^likes)
|
q = from(u in User, where: u.ap_id in ^likes)
|
||||||
|
|
||||||
users = Repo.all(q)
|
users = Repo.all(q)
|
||||||
users = if is_nil(user) do
|
|
||||||
users
|
users =
|
||||||
else
|
if is_nil(user) do
|
||||||
Enum.filter(users, &(not User.blocks?(user, &1)))
|
users
|
||||||
end
|
else
|
||||||
|
Enum.filter(users, &(not User.blocks?(user, &1)))
|
||||||
|
end
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_view(AccountView)
|
|> put_view(AccountView)
|
||||||
|
@ -905,11 +907,13 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do
|
||||||
q = from(u in User, where: u.ap_id in ^announces)
|
q = from(u in User, where: u.ap_id in ^announces)
|
||||||
|
|
||||||
users = Repo.all(q)
|
users = Repo.all(q)
|
||||||
users = if is_nil(user) do
|
|
||||||
users
|
users =
|
||||||
else
|
if is_nil(user) do
|
||||||
Enum.filter(users, &(not User.blocks?(user, &1)))
|
users
|
||||||
end
|
else
|
||||||
|
Enum.filter(users, &(not User.blocks?(user, &1)))
|
||||||
|
end
|
||||||
|
|
||||||
conn
|
conn
|
||||||
|> put_view(AccountView)
|
|> put_view(AccountView)
|
||||||
|
|
|
@ -3788,17 +3788,17 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do
|
test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do
|
||||||
other_user = insert(:user)
|
other_user = insert(:user)
|
||||||
{:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
|
{:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> assign(:user, nil)
|
|> assign(:user, nil)
|
||||||
|> get("/api/v1/#{activity.id}/favourited_by")
|
|> get("/api/v1/#{activity.id}/favourited_by")
|
||||||
|> json_response(:ok)
|
|> json_response(:ok)
|
||||||
|
|
||||||
[%{"id" => id}] = response
|
[%{"id" => id}] = response
|
||||||
assert id == other_user.id
|
assert id == other_user.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -3859,17 +3859,17 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIControllerTest do
|
||||||
end
|
end
|
||||||
|
|
||||||
test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do
|
test "does not fail on an unauthententicated request", %{conn: conn, activity: activity} do
|
||||||
other_user = insert(:user)
|
other_user = insert(:user)
|
||||||
{:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
|
{:ok, _, _} = CommonAPI.favorite(activity.id, other_user)
|
||||||
|
|
||||||
response =
|
response =
|
||||||
conn
|
conn
|
||||||
|> assign(:user, nil)
|
|> assign(:user, nil)
|
||||||
|> get("/api/v1/#{activity.id}/reblogged_by")
|
|> get("/api/v1/#{activity.id}/reblogged_by")
|
||||||
|> json_response(:ok)
|
|> json_response(:ok)
|
||||||
|
|
||||||
[%{"id" => id}] = response
|
[%{"id" => id}] = response
|
||||||
assert id == other_user.id
|
assert id == other_user.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue