Skip to content

Commit

Permalink
Fix URL generation for atom feed on history page
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Feb 7, 2021
1 parent d15041f commit e430bc0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/changesets/history.html.erb
@@ -1,6 +1,6 @@
<% content_for :auto_discovery_link_tag do -%>
<% unless params[:friends] or params[:nearby] -%>
<%= auto_discovery_link_tag :atom, @params.merge(:max_id => nil, :xhr => nil, :action => :feed) %>
<%= auto_discovery_link_tag :atom, @params.to_h.merge(:max_id => nil, :xhr => nil, :action => :feed) %>
<% end -%>
<% end -%>
Expand Down
14 changes: 14 additions & 0 deletions test/controllers/changesets_controller_test.rb
Expand Up @@ -40,6 +40,9 @@ def test_index
assert_template "history"
assert_template :layout => "map"
assert_select "h2", :text => "Changesets", :count => 1
assert_select "link[rel='alternate'][type='application/atom+xml']", :count => 1 do
assert_select "[href=?]", "http://www.example.com/history/feed"
end

get history_path(:format => "html", :list => "1"), :xhr => true
assert_response :success
Expand All @@ -58,6 +61,9 @@ def test_index_xhr
assert_template "history"
assert_template :layout => "xhr"
assert_select "h2", :text => "Changesets", :count => 1
assert_select "link[rel='alternate'][type='application/atom+xml']", :count => 1 do
assert_select "[href=?]", "http://www.example.com/history/feed"
end

get history_path(:format => "html", :list => "1"), :xhr => true
assert_response :success
Expand All @@ -84,6 +90,9 @@ def test_index_bbox
assert_template "history"
assert_template :layout => "map"
assert_select "h2", :text => "Changesets", :count => 1
assert_select "link[rel='alternate'][type='application/atom+xml']", :count => 1 do
assert_select "[href=?]", "http://www.example.com/history/feed?bbox=4.5%2C4.5%2C5.5%2C5.5"
end

get history_path(:format => "html", :bbox => "4.5,4.5,5.5,5.5", :list => "1"), :xhr => true
assert_response :success
Expand All @@ -102,6 +111,11 @@ def test_index_user
get history_path(:format => "html", :display_name => user.display_name)
assert_response :success
assert_template "history"
assert_template :layout => "map"
assert_select "h2", :text => "Changesets by #{user.display_name}", :count => 1
assert_select "link[rel='alternate'][type='application/atom+xml']", :count => 1 do
assert_select "[href=?]", "http://www.example.com/user/#{ERB::Util.url_encode(user.display_name)}/history/feed"
end

get history_path(:format => "html", :display_name => user.display_name, :list => "1"), :xhr => true
assert_response :success
Expand Down

0 comments on commit e430bc0

Please sign in to comment.