diff --git a/app/controllers/moderation/inbox_controller.rb b/app/controllers/moderation/inbox_controller.rb index 80aa94f5..b906a11c 100644 --- a/app/controllers/moderation/inbox_controller.rb +++ b/app/controllers/moderation/inbox_controller.rb @@ -5,9 +5,11 @@ class Moderation::InboxController < ApplicationController def index @user = User.find_by(screen_name: params[:user]) - @inboxes = @user.cursored_inbox(last_id: params[:last_id]) + filter = InboxFilter.new(@user, filter_params) + + @inboxes = filter.cursored_results(last_id: params[:last_id]) @inbox_last_id = @inboxes.map(&:id).min - @more_data_available = !@user.cursored_inbox(last_id: @inbox_last_id, size: 1).count.zero? + @more_data_available = !filter.cursored_results(last_id: @inbox_last_id, size: 1).count.zero? @inbox_count = @user.inbox_entries.count respond_to do |format| @@ -15,4 +17,10 @@ class Moderation::InboxController < ApplicationController format.turbo_stream { render "index", layout: false, status: :see_other } end end + + private + + def filter_params + params.slice(*InboxFilter::KEYS).permit(*InboxFilter::KEYS) + end end