diff --git a/app/controllers/account/settings_controller.rb b/app/controllers/account/settings_controller.rb index 585e87400..6b08abba2 100644 --- a/app/controllers/account/settings_controller.rb +++ b/app/controllers/account/settings_controller.rb @@ -1,6 +1,4 @@ class Account::SettingsController < ApplicationController - include FilterScoped - def show @account = Account.sole @users = User.active.alphabetically diff --git a/app/controllers/cards_controller.rb b/app/controllers/cards_controller.rb index 526806879..9a0d5d19c 100644 --- a/app/controllers/cards_controller.rb +++ b/app/controllers/cards_controller.rb @@ -6,8 +6,6 @@ class CardsController < ApplicationController before_action :set_collection, only: %i[ create ] before_action :set_card, only: %i[ show edit update destroy ] - enable_collection_filtering only: :index - PAGE_SIZE = 25 def index diff --git a/app/controllers/collections/columns/closeds_controller.rb b/app/controllers/collections/columns/closeds_controller.rb index 30d2cd2c7..2ffd7c253 100644 --- a/app/controllers/collections/columns/closeds_controller.rb +++ b/app/controllers/collections/columns/closeds_controller.rb @@ -1,5 +1,5 @@ class Collections::Columns::ClosedsController < ApplicationController - include CollectionScoped, FilterScoped + include CollectionScoped def show set_page_and_extract_portion_from @collection.cards.closed.recently_closed_first diff --git a/app/controllers/collections/columns/not_nows_controller.rb b/app/controllers/collections/columns/not_nows_controller.rb index b5a311a57..8b6b233b6 100644 --- a/app/controllers/collections/columns/not_nows_controller.rb +++ b/app/controllers/collections/columns/not_nows_controller.rb @@ -1,5 +1,5 @@ class Collections::Columns::NotNowsController < ApplicationController - include CollectionScoped, FilterScoped + include CollectionScoped def show set_page_and_extract_portion_from @collection.cards.postponed.reverse_chronologically.with_golden_first diff --git a/app/controllers/collections/columns/streams_controller.rb b/app/controllers/collections/columns/streams_controller.rb index cc1fc2f67..16a2bf671 100644 --- a/app/controllers/collections/columns/streams_controller.rb +++ b/app/controllers/collections/columns/streams_controller.rb @@ -1,5 +1,5 @@ class Collections::Columns::StreamsController < ApplicationController - include CollectionScoped, FilterScoped + include CollectionScoped def show set_page_and_extract_portion_from @collection.cards.awaiting_triage.reverse_chronologically.with_golden_first diff --git a/app/controllers/collections/columns_controller.rb b/app/controllers/collections/columns_controller.rb index 6210a9556..41ab1a56a 100644 --- a/app/controllers/collections/columns_controller.rb +++ b/app/controllers/collections/columns_controller.rb @@ -1,5 +1,5 @@ class Collections::ColumnsController < ApplicationController - include ActionView::RecordIdentifier, CollectionScoped, FilterScoped + include ActionView::RecordIdentifier, CollectionScoped before_action :set_column, only: [ :show, :update, :destroy ] diff --git a/app/controllers/concerns/filter_scoped.rb b/app/controllers/concerns/filter_scoped.rb index 2c422be2a..a9341f604 100644 --- a/app/controllers/concerns/filter_scoped.rb +++ b/app/controllers/concerns/filter_scoped.rb @@ -6,12 +6,6 @@ module FilterScoped before_action :set_user_filtering end - class_methods do - def enable_collection_filtering(**options) - before_action :enable_collection_filtering, **options - end - end - private def set_filter if params[:filter_id].present? @@ -32,24 +26,4 @@ module FilterScoped def expanded_param ActiveRecord::Type::Boolean.new.cast(params[:expand_all]) end - - def enable_collection_filtering - # We pass a block so that we don't have to pass around the script_name and host - # to the model to make +url_for+ invocable - @user_filtering.enable_collection_filtering do |**options| - url_for(options) - end - end - - def enable_referral_collection_filtering - @user_filtering.enable_collection_filtering do |**options| - if request.referer.present? - uri = URI.parse(request.referer) - uri.query = Rack::Utils.build_query(options) - uri.to_s - else - url_for(options) - end - end - end end diff --git a/app/controllers/events_controller.rb b/app/controllers/events_controller.rb index 744a7f925..5b52b02fa 100644 --- a/app/controllers/events_controller.rb +++ b/app/controllers/events_controller.rb @@ -1,8 +1,6 @@ class EventsController < ApplicationController include DayTimelinesScoped - enable_collection_filtering only: :index - def index fresh_when @day_timeline end diff --git a/app/controllers/my/menus_controller.rb b/app/controllers/my/menus_controller.rb index 1a8316957..a81705df3 100644 --- a/app/controllers/my/menus_controller.rb +++ b/app/controllers/my/menus_controller.rb @@ -1,14 +1,7 @@ class My::MenusController < ApplicationController include FilterScoped - before_action :enable_referral_collection_filtering, if: :collection_filtering_enabled? - def show fresh_when @user_filtering end - - private - def collection_filtering_enabled? - params[:enable_collection_filtering].present? - end end diff --git a/app/controllers/notifications/settings_controller.rb b/app/controllers/notifications/settings_controller.rb index 4323ed3c8..42608b558 100644 --- a/app/controllers/notifications/settings_controller.rb +++ b/app/controllers/notifications/settings_controller.rb @@ -1,5 +1,4 @@ class Notifications::SettingsController < ApplicationController - include FilterScoped before_action :set_settings def show diff --git a/app/controllers/notifications_controller.rb b/app/controllers/notifications_controller.rb index 41446b2fb..d188e3a1e 100644 --- a/app/controllers/notifications_controller.rb +++ b/app/controllers/notifications_controller.rb @@ -1,6 +1,4 @@ class NotificationsController < ApplicationController - include FilterScoped - def index @unread = Current.user.notifications.unread.ordered unless current_page_param set_page_and_extract_portion_from Current.user.notifications.read.ordered diff --git a/app/controllers/webhooks_controller.rb b/app/controllers/webhooks_controller.rb index fceb37c5c..8f8315186 100644 --- a/app/controllers/webhooks_controller.rb +++ b/app/controllers/webhooks_controller.rb @@ -1,6 +1,4 @@ class WebhooksController < ApplicationController - include FilterScoped - before_action :ensure_can_administer before_action :set_collection before_action :set_webhook, except: %i[ index new create ] diff --git a/app/models/user/filtering.rb b/app/models/user/filtering.rb index 6e00ecbc1..c9f049ab3 100644 --- a/app/models/user/filtering.rb +++ b/app/models/user/filtering.rb @@ -71,28 +71,12 @@ class User::Filtering filter.collections.any? end - def enable_collection_filtering(&block) - @collection_filtering_route_resolver = block - end - - def self_filter_path(...) - if supports_collection_filtering? - @collection_filtering_route_resolver.call(...) - else - cards_path(...) - end - end - def single_collection_or_first # Default to the first selected or, when no selection, to the first one filter.collections.first || collections.first end def cache_key - ActiveSupport::Cache.expand_cache_key([ user, filter, expanded?, collections, tags, users, filters, supports_collection_filtering? ], "user-filtering") - end - - def supports_collection_filtering? - @collection_filtering_route_resolver.present? + ActiveSupport::Cache.expand_cache_key([ user, filter, expanded?, collections, tags, users, filters ], "user-filtering") end end diff --git a/app/views/account/settings/show.html.erb b/app/views/account/settings/show.html.erb index 72bca26cb..732c49abc 100644 --- a/app/views/account/settings/show.html.erb +++ b/app/views/account/settings/show.html.erb @@ -1,7 +1,7 @@ <% @page_title = "Account Settings" %> <% content_for :header do %> - <%= render "filters/menu", user_filtering: @user_filtering %> + <%= render "filters/menu" %>