Skip to content

Commit

Permalink
AO3-6709 use i18n standard for admin only access denied error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
nish-shai-scacap committed Jul 22, 2024
1 parent d26101a commit ac2209d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,15 @@ def access_denied(options ={})
def admin_only_access_denied
respond_to do |format|
format.html do
flash[:error] = ts("Sorry, only an authorized admin can access the page you were trying to reach.")
flash[:error] = t("admin.access.page_access_denied")
redirect_to root_path
end
format.json do
errors = [ts("Sorry, only an authorized admin can do that.")]
errors = [t("admin.access.action_access_denied")]
render json: { errors: errors }, status: :forbidden
end
format.js do
flash[:error] = ts("Sorry, only an authorized admin can access the page you were trying to reach.")
flash[:error] = t("admin.access.page_access_denied")
render js: "window.location.href = '#{root_path}';"
end
end
Expand Down
3 changes: 3 additions & 0 deletions config/locales/controllers/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ en:
success:
one: "%{count} person from the invite queue is being invited."
other: "%{count} people from the invite queue are being invited."
access:
page_access_denied: Sorry, only an authorized admin can access the page you were trying to reach.
action_access_denied: Sorry, only an authorized admin can do that.
blocked:
users:
create:
Expand Down

0 comments on commit ac2209d

Please sign in to comment.