]> git.openstreetmap.org Git - rails.git/commitdiff
Merge pull request #4598 from AntonKhorev/fix-trace-description
authorAndy Allan <git@gravitystorm.co.uk>
Wed, 20 Mar 2024 17:11:37 +0000 (17:11 +0000)
committerGitHub <noreply@github.com>
Wed, 20 Mar 2024 17:11:37 +0000 (17:11 +0000)
Fix trace feed image urls and local variable names

app/views/traces/_description.html.erb
app/views/traces/georss.rss.builder
test/controllers/traces_controller_test.rb

index 5fea819da26db58997e5756b6fc6030971e89bec..538e7f1ec39222745b9a9aabe5a74f93c95447c8 100644 (file)
@@ -1,6 +1,6 @@
-<%= image_tag trace_icon_path(description.user, description.id) %>
-<% if description.size -%>
-<%= t ".description_with_count", :count => description.size, :user => description.user.display_name %>
+<%= image_tag trace_icon_url(trace.user, trace) %>
+<% if trace.size -%>
+<%= t ".description_with_count", :count => trace.size, :user => trace.user.display_name %>
 <% else -%>
-<%= t ".description_without_count", :user => description.user.display_name %>
+<%= t ".description_without_count", :user => trace.user.display_name %>
 <% end -%>
index 924ffb9357257631c1213ea138691c9e7a57b7be..ad5bd45b2248d663bb94a514d4dc82dd1bf1b2b1 100644 (file)
@@ -25,7 +25,7 @@ xml.rss("version" => "2.0",
         xml.guid show_trace_url(trace.user, trace)
 
         xml.description do
-          xml.cdata! render(:partial => "description", :object => trace, :formats => [:html])
+          xml.cdata! render(:partial => "description", :object => trace, :as => "trace", :formats => [:html])
         end
 
         xml.dc :creator, trace.user.display_name
index 2a6dc12dc3acb07c997eaa50993b62a95ffe29d1..9a818786df9ff26f203a2172d0a085f359724264 100644 (file)
@@ -810,7 +810,11 @@ class TracesControllerTest < ActionDispatch::IntegrationTest
             assert_select item, "title", trace.name
             assert_select item, "link", "http://www.example.com/user/#{ERB::Util.u(trace.user.display_name)}/traces/#{trace.id}"
             assert_select item, "guid", "http://www.example.com/user/#{ERB::Util.u(trace.user.display_name)}/traces/#{trace.id}"
-            assert_select item, "description"
+            assert_select item, "description" do
+              assert_dom_encoded do
+                assert_select "img[src='#{trace_icon_url trace.user, trace}']"
+              end
+            end
             # assert_select item, "dc:creator", trace.user.display_name
             assert_select item, "pubDate", trace.timestamp.rfc822
           end