From 4943e5b06506f4f45d0d944f3dbe3a4f650065fb Mon Sep 17 00:00:00 2001 From: Rub21 Date: Thu, 3 Sep 2026 12:55:38 +0200 Subject: [PATCH] Link to the legacy traces page from the trace list --- app/controllers/traces_controller.rb | 1 + app/views/traces/index.html.erb | 5 +++++ config/locales/en.yml | 1 + test/controllers/traces_controller_test.rb | 18 ++++++++++++++++++ 4 files changed, 25 insertions(+) diff --git a/app/controllers/traces_controller.rb b/app/controllers/traces_controller.rb index 2e180d20d..58528975d 100644 --- a/app/controllers/traces_controller.rb +++ b/app/controllers/traces_controller.rb @@ -67,6 +67,7 @@ class TracesController < ApplicationController # final helper vars for view @target_user = target_user + @legacy_traces_exist = current_user.traces.visible.exists?(:visibility => Trace::LEGACY_VISIBILITIES) if current_user end def show diff --git a/app/views/traces/index.html.erb b/app/views/traces/index.html.erb index cec2750e5..4231af1ea 100644 --- a/app/views/traces/index.html.erb +++ b/app/views/traces/index.html.erb @@ -57,6 +57,11 @@ { :controller => "traces", :action => "index", :display_name => @target_user.display_name }, { :class => "nav-link active" } %> <% end %> + <% if @legacy_traces_exist %> + + <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index 54608fa9f..cee1745db 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -3089,6 +3089,7 @@ en: my_traces: "My Traces" traces_from_html: "Public Traces from %{user}" remove_tag_filter: "Remove Tag Filter" + legacy_traces: "My Legacy Traces" destroy: scheduled_for_deletion: "Trace scheduled for deletion" legacy_visibilities: diff --git a/test/controllers/traces_controller_test.rb b/test/controllers/traces_controller_test.rb index 0ba8a0acf..afc57e945 100644 --- a/test/controllers/traces_controller_test.rb +++ b/test/controllers/traces_controller_test.rb @@ -138,6 +138,24 @@ class TracesControllerTest < ActionDispatch::IntegrationTest check_trace_index [trace_b] end + # The link to the legacy visibility page only shows up while the user + # still has traces using a legacy visibility + def test_index_legacy_traces_link + user = create(:user) + create(:trace, :visibility => "trackable", :user => user) + session_for(user) + + get traces_path + assert_response :success + assert_select "a[href=?]", edit_traces_legacy_visibility_path, :count => 0 + + create(:trace, :without_validations, :visibility => "public", :user => user) + + get traces_path + assert_response :success + assert_select "a[href=?]", edit_traces_legacy_visibility_path, :count => 1 + end + # Check the index of traces for a specific user def test_index_user user = create(:user) -- 2.47.3