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
cf10e45412
commit
555620c7b0
@ -6,20 +6,6 @@ defmodule MobilizonWeb.FallbackController do
|
|||||||
"""
|
"""
|
||||||
use MobilizonWeb, :controller
|
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
|
def call(conn, {:error, :not_found}) do
|
||||||
conn
|
conn
|
||||||
|> put_status(:not_found)
|
|> put_status(:not_found)
|
||||||
|
@ -3,6 +3,7 @@ defmodule MobilizonWeb.FeedController do
|
|||||||
Controller to serve RSS, ATOM and iCal Feeds
|
Controller to serve RSS, ATOM and iCal Feeds
|
||||||
"""
|
"""
|
||||||
use MobilizonWeb, :controller
|
use MobilizonWeb, :controller
|
||||||
|
action_fallback(MobilizonWeb.FallbackController)
|
||||||
|
|
||||||
def actor(conn, %{"name" => name, "format" => "atom"}) do
|
def actor(conn, %{"name" => name, "format" => "atom"}) do
|
||||||
with {status, data} when status in [:ok, :commit] <-
|
with {status, data} when status in [:ok, :commit] <-
|
||||||
@ -12,9 +13,7 @@ defmodule MobilizonWeb.FeedController do
|
|||||||
|> send_resp(200, data)
|
|> send_resp(200, data)
|
||||||
else
|
else
|
||||||
_err ->
|
_err ->
|
||||||
conn
|
{:error, :not_found}
|
||||||
|> put_resp_content_type("text/html")
|
|
||||||
|> send_file(404, "priv/static/index.html")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -26,9 +25,7 @@ defmodule MobilizonWeb.FeedController do
|
|||||||
|> send_resp(200, data)
|
|> send_resp(200, data)
|
||||||
else
|
else
|
||||||
_err ->
|
_err ->
|
||||||
conn
|
{:error, :not_found}
|
||||||
|> put_resp_content_type("text/html")
|
|
||||||
|> send_file(404, "priv/static/index.html")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -40,9 +37,7 @@ defmodule MobilizonWeb.FeedController do
|
|||||||
|> send_resp(200, data)
|
|> send_resp(200, data)
|
||||||
else
|
else
|
||||||
_err ->
|
_err ->
|
||||||
conn
|
{:error, :not_found}
|
||||||
|> put_resp_content_type("text/html")
|
|
||||||
|> send_file(404, "priv/static/index.html")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -54,9 +49,7 @@ defmodule MobilizonWeb.FeedController do
|
|||||||
|> send_resp(200, data)
|
|> send_resp(200, data)
|
||||||
else
|
else
|
||||||
_err ->
|
_err ->
|
||||||
conn
|
{:error, :not_found}
|
||||||
|> put_resp_content_type("text/html")
|
|
||||||
|> send_file(404, "priv/static/index.html")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -68,9 +61,7 @@ defmodule MobilizonWeb.FeedController do
|
|||||||
|> send_resp(200, data)
|
|> send_resp(200, data)
|
||||||
else
|
else
|
||||||
_err ->
|
_err ->
|
||||||
conn
|
{:error, :not_found}
|
||||||
|> put_resp_content_type("text/html")
|
|
||||||
|> send_file(404, "priv/static/index.html")
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user