From bd39560045e247b55cac736b30aaeb465b9699c5 Mon Sep 17 00:00:00 2001 From: Luis M Rodriguez-R Date: Sun, 25 Oct 2026 20:31:16 +0100 Subject: [PATCH] Closes #305 --- app/controllers/concerns/name_filterable.rb | 8 ++++---- test/controllers/names_controller_test.rb | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/controllers/concerns/name_filterable.rb b/app/controllers/concerns/name_filterable.rb index fde03c65..9702108d 100644 --- a/app/controllers/concerns/name_filterable.rb +++ b/app/controllers/concerns/name_filterable.rb @@ -20,13 +20,13 @@ def name_status_filters # Maps status strings to their corresponding integer values. # @param status [String] The status string (e.g., 'SeqCode', 'ICNP'). - # @return [Integer, Array] The status value(s). + # @return [Integer, Array, nil] The status value(s), or nil (no + # status filter) for 'all' and other statuses, such as 'user' in lists + # that are already filtered (e.g., observed names) def map_status_to_value(status) status = status.to_s.downcase - return nil if status == 'all' - status = 'icnafp' if status == 'icn' - name_status_filters[status] || status + name_status_filters[status] end end diff --git a/test/controllers/names_controller_test.rb b/test/controllers/names_controller_test.rb index 01ce7f90..1863a1cd 100644 --- a/test/controllers/names_controller_test.rb +++ b/test/controllers/names_controller_test.rb @@ -29,6 +29,18 @@ class NamesControllerTest < ActionDispatch::IntegrationTest assert_includes @response.body, names(:draft_by_contributor).name end + test 'observing lists all observed names regardless of status' do + names(:escherichia).add_observer(@user) + names(:draft_by_contributor).add_observer(@user) + + get observing_names_url + + assert_response :success + assert_includes @response.body, names(:escherichia).name + assert_includes @response.body, names(:draft_by_contributor).name + assert_not_includes @response.body, names(:escherichia_coli).name + end + test 'type_genomes JSON reports the nomenclatural type class as Genome' do get name_type_genomes_url(format: :json)