[openstreetmap/openstreetmap-website] Add a page to change legacy trace visibility in bulk (PR #7368)
Tom Hughes
notifications at github.com
Tue Sep 8 17:34:07 UTC 2026
@tomhughes commented on this pull request.
> + assert_routing(
+ { :path => "/traces/mine/legacy_visibility", :method => :patch },
+ { :controller => "traces/legacy_visibilities", :action => "update" }
+ )
+ end
+
+ def test_edit_requires_login
+ get edit_traces_legacy_visibility_path
+ assert_redirected_to login_path(:referer => edit_traces_legacy_visibility_path)
+ end
+
+ def test_edit_shows_only_own_legacy_traces
+ user = create(:user)
+ public_trace = create(:trace, :without_validations, :visibility => "public", :user => user)
+ private_trace = create(:trace, :without_validations, :visibility => "private", :user => user)
+ create(:trace, :visibility => "trackable", :user => user)
We should probably create an identifiable trace here as well to check that isn't shown.
> +
+ def test_edit_date_range_includes_both_ends
+ user = create(:user)
+ trace = create(:trace, :without_validations, :visibility => "public", :user => user, :timestamp => Time.utc(2020, 1, 1, 23, 30))
+
+ session_for(user)
+ get edit_traces_legacy_visibility_path(:from => "2020-01-01", :to => "2020-01-01")
+ assert_response :success
+ assert_select "table#trace_list tbody tr", :count => 1
+ assert_select "table#trace_list tbody tr a", trace.name
+ end
+
+ def test_edit_paged
+ user = create(:user)
+ # one trace more than fits on a single page
+ 2.times { create_list(:trace, 10, :without_validations, :visibility => "public", :user => user) }
How is creating two sets of 10 different to creating 20?
> + assert_select "table#trace_list tbody tr a", trace.name
+ end
+
+ def test_edit_paged
+ user = create(:user)
+ # one trace more than fits on a single page
+ 2.times { create_list(:trace, 10, :without_validations, :visibility => "public", :user => user) }
+ newest = create(:trace, :without_validations, :visibility => "public", :user => user)
+ ids = user.traces.order(:id => :desc).pluck(:id)
+
+ session_for(user)
+ get edit_traces_legacy_visibility_path
+ assert_response :success
+ assert_select "table#trace_list tbody tr", :count => 20
+ assert_select "table#trace_list tbody tr a", newest.name
+ assert_select "a", :text => "Older Traces", :count => 2
Maybe check that `Newer Traces` is not enabled?
> + # one trace more than fits on a single page
+ 2.times { create_list(:trace, 10, :without_validations, :visibility => "public", :user => user) }
+ newest = create(:trace, :without_validations, :visibility => "public", :user => user)
+ ids = user.traces.order(:id => :desc).pluck(:id)
+
+ session_for(user)
+ get edit_traces_legacy_visibility_path
+ assert_response :success
+ assert_select "table#trace_list tbody tr", :count => 20
+ assert_select "table#trace_list tbody tr a", newest.name
+ assert_select "a", :text => "Older Traces", :count => 2
+
+ get edit_traces_legacy_visibility_path(:before => ids[19])
+ assert_response :success
+ assert_select "table#trace_list tbody tr", :count => 1
+ assert_select "a", :text => "Newer Traces", :count => 2
...and the same here for `Older Traces`.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/7368#pullrequestreview-5144934170
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/7368/review/5144934170 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20260908/529b6d57/attachment.htm>
More information about the rails-dev
mailing list