Remove navigation parameters from issue detail URLs after updates (#42073).

Patch by Katsuya HIDAKA (user:hidakatsuya).


git-svn-id: https://svn.redmine.org/redmine/trunk@23433 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2025-01-07 07:18:32 +00:00
parent 544b7ae8fa
commit 9fccf787a4
3 changed files with 60 additions and 42 deletions

View File

@@ -2642,18 +2642,47 @@ class IssuesControllerTest < Redmine::ControllerTest
end
def test_show_should_not_display_prev_next_links_for_issue_not_in_query_results
@request.session[:issue_query] =
{
:filters => {
'status_id' => {:values => [''], :operator => 'c'}
},
:project_id => 1,
:sort => [['id', 'asc']]
}
get(:show, :params => {:id => 1})
@request.session[:issue_query] = {
filters: {
'status_id' => {operator: 'o', values: ['']}
},
project_id: 1,
sort: [['id', 'asc']]
}
get(:show, params: {id: 8})
assert_response :success
assert_select 'a', :text => /Previous/, :count => 0
assert_select 'a', :text => /Next/, :count => 0
assert_select 'a', text: /Previous/, count: 0
assert_select 'a', text: /Next/, count: 0
end
def test_show_should_display_prev_next_links_for_issue_not_in_query_when_flash_contains_previous_and_next_issue_ids
@request.session[:issue_query] = {
filters: {
'status_id' => {operator: 'o', values: ['']}
},
project_id: 1,
sort: [['id', 'asc']]
}
get(
:show,
params: { id: 8 }, # The issue#8 is closed
flash: {
previous_and_next_issue_ids: {
prev_issue_id: 7,
next_issue_id: 9,
issue_position: 7,
issue_count: 10
}
}
)
assert_response :success
assert_select 'div.next-prev-links' do
assert_select 'a[href="/issues/7"]', text: /Previous/
assert_select 'a[href="/issues/9"]', text: /Next/
assert_select 'span.position', text: "7 of 10"
end
end
def test_show_show_should_display_prev_next_links_with_query_sort_by_user_custom_field
@@ -2684,25 +2713,6 @@ class IssuesControllerTest < Redmine::ControllerTest
end
end
def test_show_should_display_prev_next_links_when_request_has_previous_and_next_issue_ids_params
get(
:show,
:params => {
:id => 1,
:prev_issue_id => 1,
:next_issue_id => 3,
:issue_position => 2,
:issue_count => 4
}
)
assert_response :success
assert_select 'div.next-prev-links' do
assert_select 'a[href="/issues/1"]', :text => /Previous/
assert_select 'a[href="/issues/3"]', :text => /Next/
assert_select 'span.position', :text => "2 of 4"
end
end
def test_show_should_display_category_field_if_categories_are_defined
Issue.update_all :category_id => nil
get(:show, :params => {:id => 1})
@@ -6903,7 +6913,11 @@ class IssuesControllerTest < Redmine::ControllerTest
:issue_count => 3
}
)
assert_redirected_to '/issues/11?issue_count=3&issue_position=2&next_issue_id=12&prev_issue_id=8'
assert_redirected_to '/issues/11'
assert_equal(
{ issue_count: '3', issue_position: '2', next_issue_id: '12', prev_issue_id: '8' },
flash[:previous_and_next_issue_ids]
)
end
def test_update_with_permission_on_tracker_should_be_allowed