mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 05:16:23 +00:00
feat: mostrar error al no tener autorización para editar un artículo
This commit is contained in:
parent
bb4f92a475
commit
9ef25521eb
3 changed files with 25 additions and 5 deletions
|
@ -10,25 +10,41 @@ module ExceptionHandler
|
|||
included do
|
||||
rescue_from SiteNotFound, with: :site_not_found
|
||||
rescue_from PageNotFound, with: :page_not_found
|
||||
rescue_from ActionController::RoutingError, with: :page_not_found
|
||||
rescue_from Pundit::NilPolicyError, with: :page_not_found
|
||||
rescue_from Pundit::Error, with: :page_not_found
|
||||
rescue_from Pundit::NotAuthorizedError, with: :page_unauthorized
|
||||
rescue_from Pundit::NilPolicyError, with: :page_not_found
|
||||
rescue_from ActionController::RoutingError, with: :page_not_found
|
||||
rescue_from ActionController::ParameterMissing, with: :page_not_found
|
||||
end
|
||||
|
||||
def site_not_found
|
||||
def site_not_found(exception)
|
||||
reset_response!
|
||||
|
||||
flash[:error] = I18n.t('errors.site_not_found')
|
||||
|
||||
ExceptionNotifier.notify_exception(exception)
|
||||
|
||||
redirect_to sites_path
|
||||
end
|
||||
|
||||
def page_not_found
|
||||
def page_unauthorized(exception)
|
||||
reset_response!
|
||||
|
||||
render 'application/page_not_found', status: :not_found
|
||||
flash[:error] = I18n.t('errors.page_unauthorized')
|
||||
|
||||
ExceptionNotifier.notify_exception(exception)
|
||||
|
||||
redirect_to site_path(site)
|
||||
end
|
||||
|
||||
def page_not_found(exception)
|
||||
reset_response!
|
||||
|
||||
flash[:error] = I18n.t('errors.page_not_found')
|
||||
|
||||
ExceptionNotifier.notify_exception(exception)
|
||||
|
||||
redirect_to site_path(site)
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -397,6 +397,8 @@ en:
|
|||
not_available: "This language is not yet available, would you help us by translating Sutty into it?"
|
||||
errors:
|
||||
site_not_found: "Site not found, or maybe you don't have access to it."
|
||||
page_not_found: "Page not found."
|
||||
page_unauthorized: "You don't have access to this page, please contact the operators of this site."
|
||||
argument_error: 'Argument `%{argument}` must be an instance of %{class}'
|
||||
unknown_locale: 'Unknown %{locale} locale'
|
||||
posts:
|
||||
|
|
|
@ -396,6 +396,8 @@ es:
|
|||
not_available: "Este idioma todavía no está disponible, ¿nos ayudas a agregarlo y mantenerlo?"
|
||||
errors:
|
||||
site_not_found: "No encontramos ese sitio o quizás no tengas acceso."
|
||||
page_not_found: "No encontramos esa página."
|
||||
page_unauthorized: "No tenés acceso a página, para solicitarla, ponete en contacto con les gestores del sitio."
|
||||
argument_error: 'El argumento `%{argument}` debe ser una instancia de %{class}'
|
||||
unknown_locale: 'El idioma %{locale} es desconocido'
|
||||
posts:
|
||||
|
|
Loading…
Reference in a new issue