Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed grammatically incorrect message while accessing pages without permission #10735

Merged
merged 4 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ def doorkeeper_unauthorized_render_options(error: nil)
def redirect_to_root_unless_user(action, *)
redirecting = !current_user&.send(action, *)
if redirecting
flash[:danger] = "You are not allowed to #{action.to_s.sub(/^can_/, '').chomp('?').humanize.downcase}"
flash[:danger] = if action == :has_permission?
t("errors.messages.no_permission")
else
"You are not allowed to #{action.to_s.sub(/^can_/, '').chomp('?').humanize.downcase}"
end
redirect_to root_url
end
redirecting
Expand Down
1 change: 1 addition & 0 deletions config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ en:
wrong_size: "is the wrong size (should be %{file_size})"
size_too_small: "is too small (should be at least %{file_size})"
size_too_big: "is too big (should be at most %{file_size})"
no_permission: "You do not have the required permissions to access this page."
devise:
#context: Overridden key for sign in
passwords:
Expand Down