Commit a99e156f authored by lain's avatar lain
Browse files

Add integer casts.

parent 7ac152ed
Pipeline #6115 passed with stages
in 6 minutes and 22 seconds
......@@ -472,7 +472,7 @@ def external_profile(%{assigns: %{user: current_user}} = conn, %{"profileurl" =>
end
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),
{:ok, followers} <- User.get_followers(user, page) do
......@@ -492,7 +492,7 @@ def followers(%{assigns: %{user: for_user}} = conn, params) do
end
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),
{:ok, friends} <- User.get_friends(user, page) do
......
......@@ -1101,7 +1101,7 @@ test "it returns 20 followers per page", %{conn: conn} do
res_conn =
conn
|> assign(:user, user)
|> get("/api/statuses/followers", %{page: 2})
|> get("/api/statuses/followers?page=2")
result = json_response(res_conn, 200)
assert length(result) == 1
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment