Fix warnings

This commit is contained in:
Shadowfacts 2020-06-07 11:14:01 -04:00
parent 58b3361623
commit 4d8bc7ad38
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
11 changed files with 10 additions and 21 deletions

View File

@ -1,7 +1,6 @@
defmodule FrenzyWeb.AccountController do defmodule FrenzyWeb.AccountController do
use FrenzyWeb, :controller use FrenzyWeb, :controller
alias Frenzy.{Repo, User, FervorClient} alias Frenzy.{Repo, User, FervorClient}
alias FrenzyWeb.Router.Helpers, as: Routes
alias FrenzyWeb.Endpoint alias FrenzyWeb.Endpoint
def show(conn, _params) do def show(conn, _params) do
@ -42,7 +41,7 @@ defmodule FrenzyWeb.AccountController do
^confirm -> ^confirm ->
changeset = User.change_password_changeset(user, %{password: new}) changeset = User.change_password_changeset(user, %{password: new})
{:ok, user} = Repo.update(changeset) {:ok, _user} = Repo.update(changeset)
conn conn
|> put_flash(:info, "Password changed.") |> put_flash(:info, "Password changed.")
@ -80,7 +79,7 @@ defmodule FrenzyWeb.AccountController do
fever_password: new fever_password: new
}) })
{:ok, user} = Repo.update(changeset) {:ok, _user} = Repo.update(changeset)
conn conn
|> put_flash(:info, "Fever password changed.") |> put_flash(:info, "Fever password changed.")

View File

@ -1,7 +1,6 @@
defmodule FrenzyWeb.FeedController do defmodule FrenzyWeb.FeedController do
use FrenzyWeb, :controller use FrenzyWeb, :controller
alias Frenzy.{Repo, Group, Feed, Item, Pipeline, Paginator} alias Frenzy.{Repo, Group, Feed, Item, Pipeline, Paginator}
alias FrenzyWeb.Router.Helpers, as: Routes
alias FrenzyWeb.Endpoint alias FrenzyWeb.Endpoint
import Ecto.Query import Ecto.Query

View File

@ -1,6 +1,6 @@
defmodule FrenzyWeb.Fervor.ItemsController do defmodule FrenzyWeb.Fervor.ItemsController do
use FrenzyWeb, :controller use FrenzyWeb, :controller
alias Frenzy.{Repo, FervorClient, Group, Feed, Filter, Item} alias Frenzy.{Repo, Item}
import Ecto.Query import Ecto.Query
alias FrenzyWeb.Fervor.Paginator alias FrenzyWeb.Fervor.Paginator

View File

@ -1,7 +1,6 @@
defmodule FrenzyWeb.Fervor.OauthController do defmodule FrenzyWeb.Fervor.OauthController do
use FrenzyWeb, :controller use FrenzyWeb, :controller
alias Frenzy.{Repo, FervorClient, User, ApprovedClient} alias Frenzy.{Repo, FervorClient, User, ApprovedClient}
alias FrenzyWeb.Router.Helpers, as: Routes
alias FrenzyWeb.Endpoint alias FrenzyWeb.Endpoint
def authorize_get(conn, params) do def authorize_get(conn, params) do

View File

@ -1,18 +1,15 @@
defmodule FrenzyWeb.Fervor.Paginator do defmodule FrenzyWeb.Fervor.Paginator do
import Ecto.Query import Ecto.Query
def paginate(query, %{"max_id" => max_id} = params) do def paginate(query, %{"max_id" => max_id}) do
limit = Map.get(params, "limit", 20)
from(o in query, where: o.id < ^max_id, order_by: [desc: :id]) from(o in query, where: o.id < ^max_id, order_by: [desc: :id])
end end
def paginate(query, %{"min_id" => min_id} = params) do def paginate(query, %{"min_id" => min_id}) do
limit = Map.get(params, "limit", 20)
from(o in query, where: o.id > ^min_id, order_by: [asc: :id]) from(o in query, where: o.id > ^min_id, order_by: [asc: :id])
end end
def paginate(query, %{"since_id" => since_id} = params) do def paginate(query, %{"since_id" => since_id}) do
limit = Map.get(params, "limit", 20)
from(o in query, where: o.id > ^since_id, order_by: [desc: :id]) from(o in query, where: o.id > ^since_id, order_by: [desc: :id])
end end

View File

@ -1,7 +1,6 @@
defmodule FrenzyWeb.GroupController do defmodule FrenzyWeb.GroupController do
use FrenzyWeb, :controller use FrenzyWeb, :controller
alias Frenzy.{Repo, Group, Feed, Item, Paginator} alias Frenzy.{Repo, Group, Feed, Item, Paginator}
alias FrenzyWeb.Router.Helpers, as: Routes
alias FrenzyWeb.Endpoint alias FrenzyWeb.Endpoint
import Ecto.Query import Ecto.Query

View File

@ -1,7 +1,6 @@
defmodule FrenzyWeb.ItemController do defmodule FrenzyWeb.ItemController do
use FrenzyWeb, :controller use FrenzyWeb, :controller
alias Frenzy.{Repo, Feed, Item} alias Frenzy.{Repo, Item}
alias FrenzyWeb.Router.Helpers, as: Routes
alias FrenzyWeb.Endpoint alias FrenzyWeb.Endpoint
plug :user_owns_item plug :user_owns_item

View File

@ -1,9 +1,7 @@
defmodule FrenzyWeb.LoginController do defmodule FrenzyWeb.LoginController do
use FrenzyWeb, :controller use FrenzyWeb, :controller
alias Frenzy.{Repo, User} alias Frenzy.{Repo, User}
alias FrenzyWeb.Router.Helpers, as: Routes
alias FrenzyWeb.Endpoint alias FrenzyWeb.Endpoint
import Ecto.Query
def login(conn, params) do def login(conn, params) do
render(conn, "login.html", %{ render(conn, "login.html", %{
@ -29,7 +27,7 @@ defmodule FrenzyWeb.LoginController do
end end
end end
def logout(conn, params) do def logout(conn, _params) do
conn conn
|> put_flash(:info, "Logged out.") |> put_flash(:info, "Logged out.")
|> clear_session() |> clear_session()

View File

@ -1,7 +1,6 @@
defmodule FrenzyWeb.PipelineController do defmodule FrenzyWeb.PipelineController do
use FrenzyWeb, :controller use FrenzyWeb, :controller
alias Frenzy.{Repo, Pipeline} alias Frenzy.{Repo, Pipeline}
alias FrenzyWeb.Router.Helpers, as: Routes
alias FrenzyWeb.Endpoint alias FrenzyWeb.Endpoint
import Ecto.Query import Ecto.Query

View File

@ -12,7 +12,7 @@
<% end %> <% end %>
</li> </li>
<li class="list-group-item"> <li class="list-group-item">
<%= form_for @conn, Routes.account_path(@conn, :export), [method: :post, class: "mt-2"], fn f -> %> <%= form_for @conn, Routes.account_path(@conn, :export), [method: :post, class: "mt-2"], fn _f -> %>
<%= submit "Export OPML", class: "btn btn-primary" %> <%= submit "Export OPML", class: "btn btn-primary" %>
<% end %> <% end %>
</li> </li>

View File

@ -1,6 +1,6 @@
defmodule FrenzyWeb.LayoutView do defmodule FrenzyWeb.LayoutView do
use FrenzyWeb, :view use FrenzyWeb, :view
alias Frenzy.{Repo, Group, Feed} alias Frenzy.{Repo, Group}
import Ecto.Query import Ecto.Query
def user_groups(user) do def user_groups(user) do