mirror of
https://akkoma.dev/AkkomaGang/akkoma.git
synced 2024-11-27 00:09:35 +00:00
Add integer casts.
This commit is contained in:
parent
7ac152ed38
commit
a99e156f2c
|
@ -472,7 +472,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
def followers(%{assigns: %{user: for_user}} = conn, params) do
|
def followers(%{assigns: %{user: for_user}} = conn, params) do
|
||||||
page = params["page"] || 1
|
{:ok, page} = Ecto.Type.cast(:integer, params["page"] || 1)
|
||||||
|
|
||||||
with {:ok, user} <- TwitterAPI.get_user(for_user, params),
|
with {:ok, user} <- TwitterAPI.get_user(for_user, params),
|
||||||
{:ok, followers} <- User.get_followers(user, page) do
|
{:ok, followers} <- User.get_followers(user, page) do
|
||||||
|
@ -492,7 +492,7 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
||||||
end
|
end
|
||||||
|
|
||||||
def friends(%{assigns: %{user: for_user}} = conn, params) do
|
def friends(%{assigns: %{user: for_user}} = conn, params) do
|
||||||
page = params["page"] || 1
|
{:ok, page} = Ecto.Type.cast(:integer, params["page"] || 1)
|
||||||
|
|
||||||
with {:ok, user} <- TwitterAPI.get_user(conn.assigns[:user], params),
|
with {:ok, user} <- TwitterAPI.get_user(conn.assigns[:user], params),
|
||||||
{:ok, friends} <- User.get_friends(user, page) do
|
{:ok, friends} <- User.get_friends(user, page) do
|
||||||
|
|
|
@ -1101,7 +1101,7 @@ defmodule Pleroma.Web.TwitterAPI.ControllerTest do
|
||||||
res_conn =
|
res_conn =
|
||||||
conn
|
conn
|
||||||
|> assign(:user, user)
|
|> assign(:user, user)
|
||||||
|> get("/api/statuses/followers", %{page: 2})
|
|> get("/api/statuses/followers?page=2")
|
||||||
|
|
||||||
result = json_response(res_conn, 200)
|
result = json_response(res_conn, 200)
|
||||||
assert length(result) == 1
|
assert length(result) == 1
|
||||||
|
|
Loading…
Reference in a new issue