Merge branch 'static-remote-redirect' into 'develop'

For remote notices, redirect to the original instead of 404 in static-fe

See merge request pleroma/pleroma!1974
This commit is contained in:
lain 2019-11-13 10:16:00 +00:00
commit facc37aaa6
2 changed files with 7 additions and 2 deletions

View file

@ -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)

View file

@ -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