fix warnings
This commit is contained in:
@ -7,7 +7,7 @@ defmodule SomethingErlang.Accounts do
|
||||
alias SomethingErlang.Repo
|
||||
|
||||
alias SomethingErlang.AwfulApi.Client
|
||||
alias SomethingErlang.Accounts.{User, UserToken, UserNotifier}
|
||||
alias SomethingErlang.Accounts.{User, UserToken}
|
||||
|
||||
## Database getters
|
||||
|
||||
|
@ -8,7 +8,7 @@ defmodule SomethingErlang.Accounts.User do
|
||||
timestamps()
|
||||
end
|
||||
|
||||
def registration_changeset(user, attrs, opts \\ []) do
|
||||
def registration_changeset(user, attrs, _opts \\ []) do
|
||||
user
|
||||
|> cast(attrs, [:bbuserid])
|
||||
|> validate_required([:bbuserid])
|
||||
|
@ -2,8 +2,11 @@ defmodule SomethingErlang.AwfulApi.Client do
|
||||
@base_url "https://forums.somethingawful.com/"
|
||||
@user_agent "SomethingErlangClient/0.1"
|
||||
|
||||
require Logger
|
||||
|
||||
def thread_doc(id, page, user) do
|
||||
resp = new(user) |> get_thread(id, page)
|
||||
Logger.debug("Client reply in #{resp.private.time}ms ")
|
||||
:unicode.characters_to_binary(resp.body, :latin1)
|
||||
end
|
||||
|
||||
@ -66,8 +69,16 @@ defmodule SomethingErlang.AwfulApi.Client do
|
||||
cache: true,
|
||||
headers: [cookie: [cookies(%{bbuserid: user.id, bbpassword: user.hash})]]
|
||||
)
|
||||
|
||||
# |> Req.Request.append_request_steps(inspect: &IO.inspect/1)
|
||||
|> Req.Request.append_request_steps(
|
||||
time: fn req -> Req.Request.put_private(req, :time, Time.utc_now()) end
|
||||
)
|
||||
|> Req.Request.prepend_response_steps(
|
||||
time: fn {req, res} ->
|
||||
start = req.private.time
|
||||
diff = Time.diff(Time.utc_now(), start, :millisecond)
|
||||
{req, Req.Response.put_private(res, :time, diff)}
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
defp new() do
|
||||
@ -76,8 +87,6 @@ defmodule SomethingErlang.AwfulApi.Client do
|
||||
user_agent: @user_agent,
|
||||
redirect: false
|
||||
)
|
||||
|
||||
# |> Req.Request.append_request_steps(inspect: &IO.inspect/1)
|
||||
end
|
||||
|
||||
defp cookies(args) when is_map(args) do
|
||||
|
@ -27,7 +27,7 @@ defmodule SomethingErlangWeb.PageController do
|
||||
end
|
||||
end
|
||||
|
||||
def to_forum_path(conn, params) do
|
||||
def to_forum_path(conn, _params) do
|
||||
render(conn, :home)
|
||||
end
|
||||
end
|
||||
|
@ -50,7 +50,7 @@ defmodule SomethingErlangWeb.ThreadLive do
|
||||
~H"""
|
||||
<aside class="userinfo bg-base-100">
|
||||
<h3 class="mb-4"><%= @info.name %></h3>
|
||||
<div class="title hidden sm:flex flex-col text-sm pr-4 sm:hidden">
|
||||
<div class="title hidden sm:flex flex-col text-sm pr-4">
|
||||
<%= raw(@info.title) %>
|
||||
</div>
|
||||
</aside>
|
||||
@ -85,7 +85,7 @@ defmodule SomethingErlangWeb.ThreadLive do
|
||||
|
||||
defp label_button(%{label: "«", page: page} = assigns),
|
||||
do: ~H"""
|
||||
<Heroicons.chevron_double_left mini /><%= @page %>
|
||||
<Heroicons.chevron_double_left mini /><%= page %>
|
||||
"""
|
||||
|
||||
defp label_button(%{label: "‹", page: page} = assigns),
|
||||
@ -128,9 +128,11 @@ defmodule SomethingErlangWeb.ThreadLive do
|
||||
end
|
||||
|
||||
def mount(_params, session, socket) do
|
||||
socket.assigns.current_user
|
||||
|> Map.put(:bbpassword, session["bbpassword"])
|
||||
|> Grover.mount()
|
||||
user =
|
||||
socket.assigns.current_user
|
||||
|> Map.put(:bbpassword, session["bbpassword"])
|
||||
|
||||
Grover.mount(user)
|
||||
|
||||
{:ok, socket}
|
||||
end
|
||||
|
Reference in New Issue
Block a user