From a342296fcd66f5e6e8407e43a45cf66c664edd22 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 20 Nov 2025 10:45:23 +0000 Subject: [PATCH 1/3] Initial plan From 37754fd1f4567a1fc3d18560c437c86b971deef6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 20 Nov 2025 10:50:25 +0000 Subject: [PATCH 2/3] Add include_broken_links filter for events and materials Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com> --- app/models/concerns/searchable.rb | 7 ------- app/views/search/common/_facet_sidebar.html.erb | 10 ++++++++++ config/locales/en.yml | 2 ++ lib/facets.rb | 8 +++++++- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/app/models/concerns/searchable.rb b/app/models/concerns/searchable.rb index 22bfaafbc..218ec215a 100644 --- a/app/models/concerns/searchable.rb +++ b/app/models/concerns/searchable.rb @@ -105,13 +105,6 @@ def search_and_filter(user, search_params = '', selected_facets = {}, page: 1, s facet ff, exclude: active_facets[ff] end - # Hide records the urls of which are failing - if method_defined?(:link_monitor) - unless user&.is_admin? - without(:failing, true) - end - end - end end end diff --git a/app/views/search/common/_facet_sidebar.html.erb b/app/views/search/common/_facet_sidebar.html.erb index b1b466b78..72a7534ee 100644 --- a/app/views/search/common/_facet_sidebar.html.erb +++ b/app/views/search/common/_facet_sidebar.html.erb @@ -63,6 +63,11 @@ Variable that should be available count: '-', enable_text: t('sidebar.filter.values.show_disabled_events'), disable_text: t('sidebar.filter.values.hide_disabled_events') } %> + <%= render partial: 'search/common/facet_sidebar_boolean_filter', + locals: { facet_field: 'include_broken_links', + count: '-', + enable_text: t('sidebar.filter.values.show_broken_links', resource: resource_type.model_name.human.downcase.pluralize), + disable_text: t('sidebar.filter.values.hide_broken_links', resource: resource_type.model_name.human.downcase.pluralize) } %> <% elsif resource_type.name == 'Material' || resource_type.name == 'LearningPath' %> <% resource_name = resource_type.model_name.human.downcase.pluralize %> <% if resource_type.name == 'Material' %> @@ -71,6 +76,11 @@ Variable that should be available count: '-', enable_text: t('sidebar.filter.values.show_disabled', resource: resource_name), disable_text: t('sidebar.filter.values.hide_disabled', resource: resource_name) } %> + <%= render partial: 'search/common/facet_sidebar_boolean_filter', + locals: { facet_field: 'include_broken_links', + count: '-', + enable_text: t('sidebar.filter.values.show_broken_links', resource: resource_name), + disable_text: t('sidebar.filter.values.hide_broken_links', resource: resource_name) } %> <% end %> <%= render partial: 'search/common/facet_sidebar_boolean_filter', locals: { facet_field: 'include_archived', diff --git a/config/locales/en.yml b/config/locales/en.yml index 3fe74d161..0de61fb83 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -874,6 +874,8 @@ en: hide_disabled: 'Hide disabled %{resource}' show_archived: 'Show archived %{resource}' hide_archived: 'Hide archived %{resource}' + show_broken_links: 'Show %{resource} with broken links' + hide_broken_links: 'Hide %{resource} with broken links' show_cross_space: 'Show %{resource} from all spaces' hide_cross_space: 'Hide %{resource} from all spaces' hidden: diff --git a/lib/facets.rb b/lib/facets.rb index 57d1cfba4..686316428 100644 --- a/lib/facets.rb +++ b/lib/facets.rb @@ -9,6 +9,7 @@ module Facets start: ->(c) { c.name == 'Event' }, running_during: ->(c) { c.name == 'Event' }, include_hidden: ->(c) { c.method_defined?(:user_requires_approval?) }, + include_broken_links: ->(c) { c.method_defined?(:link_monitor) }, across_all_spaces: ->(c) { TeSS::Config.feature['spaces'] && c.reflect_on_association(:space) } }.with_indifferent_access.freeze @@ -32,7 +33,8 @@ module Facets nil end }, - include_hidden: ->(value) { value == 'true' } + include_hidden: ->(value) { value == 'true' }, + include_broken_links: ->(value) { value == 'true' } } class << self @@ -113,6 +115,10 @@ def include_hidden(scope, value, user) end end + def include_broken_links(scope, value, _) + sunspot_scoped(scope) { without(:failing, true) } unless value + end + def days_since_scrape(scope, days, _) sunspot_scoped(scope) { with(:last_scraped).less_than(days.to_i.days.ago) } if days.present? end From 69d742f54aaa5c3e31cdd1c126655c1be7d25c8a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 25 Nov 2025 15:37:07 +0000 Subject: [PATCH 3/3] Add include_broken_links parameter to OpenAPI specs for events and materials Co-authored-by: fbacall <503373+fbacall@users.noreply.github.com> --- public/api/definitions/tess.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/public/api/definitions/tess.yml b/public/api/definitions/tess.yml index bb8a647f9..4abe2470b 100644 --- a/public/api/definitions/tess.yml +++ b/public/api/definitions/tess.yml @@ -190,6 +190,11 @@ paths: description: Include events that are disabled. schema: type: boolean + - name: include_broken_links + in: query + description: Include events that have broken links. + schema: + type: boolean - name: eligibility[] in: query description: Filter by who is eligible to attend the event. @@ -429,6 +434,11 @@ paths: description: Include materials that are disabled. schema: type: boolean + - name: include_broken_links + in: query + description: Include materials that have broken links. + schema: + type: boolean responses: 200: description: A collection of materials, and facets available to filter them.