Skip to content
Open
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
4 changes: 0 additions & 4 deletions app/controllers/mentoring/requests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ def show
end
end

def unavailable
render status: :not_found
end

private
def use_mentor_request
@mentor_request = Mentor::Request.find_by!(uuid: params[:uuid])
Expand Down
8 changes: 5 additions & 3 deletions app/views/mentoring/requests/unavailable.html.haml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Unavailable.

= link_to "Back to list", mentoring_queue_path
#page-mentoring-unavailable
.lg-container.flex.flex-col.items-center.c-shapes.c-shapes-1
= graphical_icon "error-404", category: :graphics, css_class: 'w-[120px] h-[120px] mb-24'
%h1.text-h1.mb-16= t('.unavailable')
= link_to t('.back_to_list'), mentoring_queue_path, class: 'btn-primary btn-l'
6 changes: 6 additions & 0 deletions config/locales/mentoring.en.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
en:
mentoring:
requests:
unavailable:
unavailable: "Sorry, this mentoring session is no longer available"
back_to_list: "Back to list"
13 changes: 13 additions & 0 deletions test/controllers/mentoring/requests_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,17 @@ class Mentoring::RequestsControllerTest < ActionDispatch::IntegrationTest
get mentoring_request_path(request)
assert_redirected_to unavailable_mentoring_request_path(request)
end

test "unavailable action renders properly" do
mentor = create :user
sign_in!(mentor)

request = create :mentor_request

get unavailable_mentoring_request_path(request)
assert_response :success
assert_select "#page-mentoring-unavailable"
assert_select "h1", text: "Sorry, this mentoring session is no longer available"
assert_select "a.btn-primary", text: "Back to list"
end
end