forked from potsda.mn/mobilizon
Fix tests for FeedController
And remove useless Fallbacks in Fallback controller Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
7c8f1a56af
commit
e97be0b814
|
@ -6,20 +6,6 @@ defmodule MobilizonWeb.FallbackController do
|
|||
"""
|
||||
use MobilizonWeb, :controller
|
||||
|
||||
def call(conn, {:error, %Ecto.Changeset{} = changeset}) do
|
||||
conn
|
||||
|> put_status(:unprocessable_entity)
|
||||
|> put_view(MobilizonWeb.ChangesetView)
|
||||
|> render("error.json", changeset: changeset)
|
||||
end
|
||||
|
||||
def call(conn, {:error, nil}) do
|
||||
conn
|
||||
|> put_status(:unprocessable_entity)
|
||||
|> put_view(MobilizonWeb.ErrorView)
|
||||
|> render("invalid_request.json")
|
||||
end
|
||||
|
||||
def call(conn, {:error, :not_found}) do
|
||||
conn
|
||||
|> put_status(:not_found)
|
||||
|
|
|
@ -3,6 +3,7 @@ defmodule MobilizonWeb.FeedController do
|
|||
Controller to serve RSS, ATOM and iCal Feeds
|
||||
"""
|
||||
use MobilizonWeb, :controller
|
||||
action_fallback(MobilizonWeb.FallbackController)
|
||||
|
||||
def actor(conn, %{"name" => name, "format" => "atom"}) do
|
||||
with {status, data} when status in [:ok, :commit] <-
|
||||
|
@ -12,9 +13,7 @@ defmodule MobilizonWeb.FeedController do
|
|||
|> send_resp(200, data)
|
||||
else
|
||||
_err ->
|
||||
conn
|
||||
|> put_resp_content_type("text/html")
|
||||
|> send_file(404, "priv/static/index.html")
|
||||
{:error, :not_found}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -26,9 +25,7 @@ defmodule MobilizonWeb.FeedController do
|
|||
|> send_resp(200, data)
|
||||
else
|
||||
_err ->
|
||||
conn
|
||||
|> put_resp_content_type("text/html")
|
||||
|> send_file(404, "priv/static/index.html")
|
||||
{:error, :not_found}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,9 +37,7 @@ defmodule MobilizonWeb.FeedController do
|
|||
|> send_resp(200, data)
|
||||
else
|
||||
_err ->
|
||||
conn
|
||||
|> put_resp_content_type("text/html")
|
||||
|> send_file(404, "priv/static/index.html")
|
||||
{:error, :not_found}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -54,9 +49,7 @@ defmodule MobilizonWeb.FeedController do
|
|||
|> send_resp(200, data)
|
||||
else
|
||||
_err ->
|
||||
conn
|
||||
|> put_resp_content_type("text/html")
|
||||
|> send_file(404, "priv/static/index.html")
|
||||
{:error, :not_found}
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -68,9 +61,7 @@ defmodule MobilizonWeb.FeedController do
|
|||
|> send_resp(200, data)
|
||||
else
|
||||
_err ->
|
||||
conn
|
||||
|> put_resp_content_type("text/html")
|
||||
|> send_file(404, "priv/static/index.html")
|
||||
{:error, :not_found}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue