FEATURE: Show a detailed 404 page for private topics (#9894)

This commit is contained in:
Dan Ungureanu 2020-05-27 20:10:01 +03:00 committed by GitHub
parent 7bc496070f
commit 570b12a903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

View File

@ -245,12 +245,20 @@ class ApplicationController < ActionController::Base
end
end
message = opts[:custom_message_translated] || I18n.t(opts[:custom_message] || type)
error_page_opts = {
title: opts[:custom_message_translated] || I18n.t(opts[:custom_message] || "page_not_found.title"),
status: status_code,
group: opts[:group]
}
if opts[:custom_message_translated]
title = message = opts[:custom_message_translated]
elsif opts[:custom_message]
title = message = I18n.t(opts[:custom_message])
else
message = I18n.t(type)
if status_code == 403
title = I18n.t("page_forbidden.title")
else
title = I18n.t("page_not_found.title")
end
end
error_page_opts = { title: title, status: status_code, group: opts[:group] }
if show_json_errors
opts = { type: type, status: status_code }

View File

@ -3738,6 +3738,9 @@ en:
If this was not you, please [review your existing sessions](%{base_url}/my/preferences/account) and consider changing your password.
page_forbidden:
title: "Oops! That page is private."
page_not_found:
title: "Oops! That page doesnt exist or is private."
popular_topics: "Popular"