Better error handling for user feeds.
This commit is contained in:
parent
7b0dd964be
commit
11714fbaa2
|
@ -8,12 +8,14 @@ defmodule Pleroma.Web.OStatus.OStatusController do
|
||||||
import Ecto.Query
|
import Ecto.Query
|
||||||
|
|
||||||
def feed_redirect(conn, %{"nickname" => nickname}) do
|
def feed_redirect(conn, %{"nickname" => nickname}) do
|
||||||
user = User.get_cached_by_nickname(nickname)
|
with %User{} = user <- User.get_cached_by_nickname(nickname) do
|
||||||
|
|
||||||
case get_format(conn) do
|
case get_format(conn) do
|
||||||
"html" -> Fallback.RedirectController.redirector(conn, nil)
|
"html" -> Fallback.RedirectController.redirector(conn, nil)
|
||||||
_ -> redirect conn, external: OStatus.feed_path(user)
|
_ -> redirect conn, external: OStatus.feed_path(user)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
_e -> send_resp(conn, 404, "No user found")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def feed(conn, %{"nickname" => nickname}) do
|
def feed(conn, %{"nickname" => nickname}) do
|
||||||
|
|
Loading…
Reference in a new issue