From 3c77fa98c9407ae76a3b0d30872fef09bbf18221 Mon Sep 17 00:00:00 2001 From: Ahesh Lakmal Date: Wed, 18 Nov 2026 23:50:43 +0100 Subject: [PATCH] Select the Notes tab by default when the history default tab preference is not set (#44731). UserPreference#history_default_tab is nil until the user saves the preference, for example for anonymous users and for users who never saved their account page. IssuesHelper#issue_history_default_tab mapped only an empty string to 'notes' and returned nil unchanged, so render_tabs fell back to the first tab (History). --- app/helpers/issues_helper.rb | 2 +- test/functional/issues_controller_test.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index fbfa7fb66..af3f6bf80 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -770,7 +770,7 @@ module IssuesHelper case user_default_tab when 'last_tab_visited' cookies['history_last_tab'].presence || 'notes' - when '' + when '', nil 'notes' else user_default_tab diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 483c92e44..2a1d5377a 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -3421,6 +3421,22 @@ class IssuesControllerTest < Redmine::ControllerTest end end + def test_show_should_select_notes_tab_when_history_default_tab_preference_is_not_set + assert_nil User.find(1).pref.history_default_tab + @request.session[:user_id] = 1 + + get :show, :params => {:id => 1} + assert_response :success + assert_select '#history div.tabs a.selected', 1 + assert_select '#history div.tabs a.selected[id=?]', 'tab-notes' + end + + def test_show_should_select_notes_tab_for_anonymous + get :show, :params => {:id => 1} + assert_response :success + assert_select '#history div.tabs a.selected[id=?]', 'tab-notes' + end + def test_show_display_changesets_tab_for_issue_with_changesets project = Project.find(2) issue = Issue.find(9) -- 2.56.1.windows.1