Skip to content

Commit

Permalink
Fix browse notes timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Apr 4, 2024
1 parent 7caa024 commit 30c1374
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/notes_controller.rb
Expand Up @@ -11,7 +11,7 @@ class NotesController < ApplicationController

before_action :lookup_user, :only => [:index]
before_action :set_locale
around_action :web_timeout
around_action :web_timeout, :only => :show

##
# Display a list of notes by a specified user
Expand Down
5 changes: 5 additions & 0 deletions app/views/notes/timeout.html.erb
@@ -0,0 +1,5 @@
<% set_title(t("browse.timeout.title")) %>
<%= render "sidebar_header", :title => t("browse.timeout.title") %>

<p><%= t ".sorry", :id => params[:id] %>
2 changes: 2 additions & 0 deletions config/locales/en.yml
Expand Up @@ -3055,6 +3055,8 @@ en:
intro: "Spotted a mistake or something missing? Let other mappers know so we can fix it. Move the marker to the correct position and type a note to explain the problem."
advice: "Your note is public and may be used to update the map, so don't enter personal information, or information from copyrighted maps or directory listings."
add: Add Note
timeout:
sorry: "Sorry, the data for the note with the id %{id}, took too long to retrieve."
javascripts:
close: Close
share:
Expand Down
11 changes: 11 additions & 0 deletions test/controllers/notes_controller_test.rb
Expand Up @@ -160,6 +160,17 @@ def test_read_closed_note
assert_select "div.details", /Resolved by deleted/
end

def test_show_timeout
note = create(:note_with_comments)
with_settings(:web_timeout => -1) do
get note_path(note)
end
assert_response :success
assert_template :layout => "map"
assert_dom "h2", "Timeout Error"
assert_dom "p", /#{Regexp.quote("the note with the id #{note.id}")}/
end

def test_new_note
get new_note_path
assert_response :success
Expand Down

0 comments on commit 30c1374

Please sign in to comment.