Skip to content

Commit

Permalink
Supporting DisabledError
Browse files Browse the repository at this point in the history
  • Loading branch information
flbulgarelli committed May 29, 2020
1 parent a4a88a6 commit e0fc96b
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lib/mumuki/laboratory/controllers/dynamic_errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module Mumuki::Laboratory::Controllers::DynamicErrors
rescue_from Mumuki::Domain::UnauthorizedError, with: :unauthorized
rescue_from Mumuki::Domain::GoneError, with: :gone
rescue_from Mumuki::Domain::BlockedForumError, with: :blocked_forum
rescue_from Mumuki::Domain::DisabledError, with: :disabled
rescue_from ActiveRecord::RecordInvalid, with: :bad_record
end

Expand Down Expand Up @@ -41,6 +42,10 @@ def forbidden
render_error 'forbidden', 403, locals: { explanation: :forbidden_explanation }, error_message: message
end

def disabled
render_error 'forbidden', 403, locals: { explanation: :disabled_explanation }
end

def blocked_forum
render_error 'forbidden', 403, locals: { explanation: :blocked_forum_explanation }
end
Expand Down
3 changes: 2 additions & 1 deletion lib/mumuki/laboratory/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ en:
created_at: Created at
date: Date
description: Description
destroy: Destroy
destroy_message: delete the message
destroy: Destroy
disabled_explanation: You are trying to visit a permamently disabled or deleted resource
discussion_updated: Discussion updated
discussions: Discussions
dont_leave_us: Don't leave us! Learning is fun. You just have to keep at it.
Expand Down
3 changes: 2 additions & 1 deletion lib/mumuki/laboratory/locales/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ es:
day: Día
days: Días
description: Descripción
destroy: Eliminar
destroy_message: eliminar el mensaje
destroy: Eliminar
details: Detalles
disabled_explanation: Estás intentando acceder a un recurso que fue deshabilitado o eliminado de forma permamente
discussion_updated: Consulta actualizada
discussions: Consultas
dont_leave_us: ¡No nos abandones! Aprender a programar es divertido. Sólo tenés que seguir practicando.
Expand Down
3 changes: 2 additions & 1 deletion lib/mumuki/laboratory/locales/pt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ pt:
day: Dia
days: Dias
description: Descrição
destroy: Excluir
destroy_message: excluir a mensagem
destroy: Excluir
details: Detalhes
disabled_explanation: Você está tentando acessar um recurso que foi desativado ou removido permanentemente
discussion_updated: Consulta actualizada
discussions: Consultas
download: Faça o download do que você fez
Expand Down
2 changes: 1 addition & 1 deletion spec/features/disable_user_flow_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@

expect(page).to_not have_text('ム mumuki')
expect(page).to_not have_text(current_organization.book.name)
expect(page).to have_text('You are not allowed to see this content')
expect(page).to have_text('You are trying to visit a permamently disabled or deleted resource')
end
end

0 comments on commit e0fc96b

Please sign in to comment.