For remote notices, redirect to the original instead of 404.
We shouldn't treat these like local statuses, but I don't think a 404 is the right choice either here, because within pleroma-fe, these are valid URLs. So with remote notices you have the awkward situation where clicking a link will behave differently depending on whether you open it in a new tab or not; the new tab will 404 if it hits static-fe. This new redirecting behavior should improve that situation.
This commit is contained in:
parent
fb090b748a
commit
62f3a93049
|
@ -77,6 +77,11 @@ def show(%{assigns: %{notice_id: notice_id}} = conn, _params) do
|
||||||
|
|
||||||
render(conn, "conversation.html", %{activities: timeline, meta: meta})
|
render(conn, "conversation.html", %{activities: timeline, meta: meta})
|
||||||
else
|
else
|
||||||
|
%Activity{object: %Object{data: data}} ->
|
||||||
|
conn
|
||||||
|
|> put_status(:found)
|
||||||
|
|> redirect(external: data["url"] || data["external_url"] || data["id"])
|
||||||
|
|
||||||
_ ->
|
_ ->
|
||||||
conn
|
conn
|
||||||
|> put_status(404)
|
|> put_status(404)
|
||||||
|
|
|
@ -151,7 +151,7 @@ test "404 for private status", %{conn: conn} do
|
||||||
assert html_response(conn, 404) =~ "not found"
|
assert html_response(conn, 404) =~ "not found"
|
||||||
end
|
end
|
||||||
|
|
||||||
test "404 for remote cached status", %{conn: conn} do
|
test "302 for remote cached status", %{conn: conn} do
|
||||||
user = insert(:user)
|
user = insert(:user)
|
||||||
|
|
||||||
message = %{
|
message = %{
|
||||||
|
@ -175,7 +175,7 @@ test "404 for remote cached status", %{conn: conn} do
|
||||||
|> put_req_header("accept", "text/html")
|
|> put_req_header("accept", "text/html")
|
||||||
|> get("/notice/#{activity.id}")
|
|> get("/notice/#{activity.id}")
|
||||||
|
|
||||||
assert html_response(conn, 404) =~ "not found"
|
assert html_response(conn, 302) =~ "redirected"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue