2022-06-19 15:59:47 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Moderation::InboxController < ApplicationController
|
|
|
|
before_action :authenticate_user!
|
|
|
|
|
|
|
|
def index
|
|
|
|
@user = User.find_by(screen_name: params[:user])
|
2024-01-27 11:15:13 -08:00
|
|
|
filter = InboxFilter.new(@user, filter_params)
|
|
|
|
|
|
|
|
@inboxes = filter.cursored_results(last_id: params[:last_id])
|
2022-06-19 15:59:47 -07:00
|
|
|
@inbox_last_id = @inboxes.map(&:id).min
|
2024-01-27 11:15:13 -08:00
|
|
|
@more_data_available = !filter.cursored_results(last_id: @inbox_last_id, size: 1).count.zero?
|
2024-01-27 04:04:29 -08:00
|
|
|
@inbox_count = @user.inbox_entries.count
|
2022-06-19 15:59:47 -07:00
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html
|
2022-09-07 15:55:10 -07:00
|
|
|
format.turbo_stream { render "index", layout: false, status: :see_other }
|
2022-06-19 15:59:47 -07:00
|
|
|
end
|
|
|
|
end
|
2024-01-27 11:15:13 -08:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def filter_params
|
|
|
|
params.slice(*InboxFilter::KEYS).permit(*InboxFilter::KEYS)
|
|
|
|
end
|
2022-06-19 15:59:47 -07:00
|
|
|
end
|