diff --git a/app/views/logs/_log_filters.html.erb b/app/views/logs/_log_filters.html.erb index ffa05c2d8..06118835e 100644 --- a/app/views/logs/_log_filters.html.erb +++ b/app/views/logs/_log_filters.html.erb @@ -93,7 +93,7 @@ } %> <% end %> - <% if current_user.support? || non_support_with_multiple_managing_orgs? %> + <% if (current_user.support? || non_support_with_multiple_managing_orgs?) && user_or_org_lettings_path? %> <%= render partial: "filters/radio_filter", locals: { f:, options: { diff --git a/spec/features/organisation_spec.rb b/spec/features/organisation_spec.rb index 6b4efb80c..15e6642d1 100644 --- a/spec/features/organisation_spec.rb +++ b/spec/features/organisation_spec.rb @@ -194,7 +194,7 @@ RSpec.describe "User Features" do end check("years-2021-field") click_button("Apply filters") - expect(page).to have_current_path("/organisations/#{org_id}/lettings-logs?years[]=&years[]=2021&status[]=&assigned_to=all&user=&owning_organisation_select=all&owning_organisation=") + expect(page).to have_current_path("/organisations/#{org_id}/lettings-logs?years[]=&years[]=2021&status[]=&assigned_to=all&user=&owning_organisation_select=all&owning_organisation=&managing_organisation_select=all&managing_organisation=") expect(page).not_to have_link first_log.id.to_s, href: "/lettings-logs/#{first_log.id}" end end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 63ea72dca..2ea32ce6a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -163,7 +163,7 @@ RSpec.describe User, type: :model do end it "can filter lettings logs by user, year and status" do - expect(user.logs_filters).to eq(%w[status years assigned_to user bulk_upload_id]) + expect(user.logs_filters).to match_array(%w[status needstypes years assigned_to user bulk_upload_id]) end end @@ -173,7 +173,7 @@ RSpec.describe User, type: :model do end it "can filter lettings logs by user, year, status, managing_organisation and owning_organisation" do - expect(user.logs_filters).to match_array(%w[status years assigned_to user managing_organisation owning_organisation bulk_upload_id]) + expect(user.logs_filters).to match_array(%w[status needstypes years assigned_to user managing_organisation owning_organisation bulk_upload_id]) end end end @@ -214,7 +214,7 @@ RSpec.describe User, type: :model do end it "can filter lettings logs by user, year, status, managing_organisation and owning_organisation" do - expect(user.logs_filters).to match_array(%w[status years assigned_to user owning_organisation managing_organisation bulk_upload_id]) + expect(user.logs_filters).to match_array(%w[status needstypes years assigned_to user owning_organisation managing_organisation bulk_upload_id]) end end