Added/Updated admin dashboard tables
• Added: - New Account filtering - PreviewCard viewing/sorting/filtering deleting (todo) - DeletePreviewCardWorker, Service - Status viewing/sorting/filtering deleting - ChatMessage viewing/sorting/filtering deleting (todo) - Account > Follows view • Updated: - LinkBlock to sort alphabetically - Groups to be under "Moderation" instead of "Admin" in navigation.rb - Status in admin to have group name/link - Reports reset button - Group filtering/sorting - LinkBlock filtering/sorting - Account now has bio and few more data points in dashboard
This commit is contained in:
@@ -4,21 +4,12 @@ module Admin
|
||||
class StatusesController < BaseController
|
||||
helper_method :current_params
|
||||
|
||||
before_action :set_account
|
||||
|
||||
PER_PAGE = 20
|
||||
|
||||
def index
|
||||
authorize :status, :index?
|
||||
|
||||
@statuses = @account.statuses.where(visibility: [:public, :unlisted])
|
||||
|
||||
if params[:media]
|
||||
account_media_status_ids = @account.media_attachments.attached.reorder(nil).select(:status_id).distinct
|
||||
@statuses.merge!(Status.where(id: account_media_status_ids))
|
||||
end
|
||||
|
||||
@statuses = @statuses.preload(:media_attachments, :mentions).page(params[:page]).per(PER_PAGE)
|
||||
@statuses = filtered_statuses.preload(:media_attachments, :mentions).page(params[:page]).per(PER_PAGE)
|
||||
@form = Form::StatusBatch.new
|
||||
end
|
||||
|
||||
@@ -37,11 +28,11 @@ module Admin
|
||||
@form = Form::StatusBatch.new(form_status_batch_params.merge(current_account: current_account, action: action_from_button))
|
||||
flash[:alert] = I18n.t('admin.statuses.failed_to_execute') unless @form.save
|
||||
|
||||
redirect_to admin_account_statuses_path(@account.id, current_params)
|
||||
redirect_to admin_statuses_path(current_params)
|
||||
rescue ActionController::ParameterMissing
|
||||
flash[:alert] = I18n.t('admin.statuses.no_status_selected')
|
||||
|
||||
redirect_to admin_account_statuses_path(@account.id, current_params)
|
||||
redirect_to admin_statuses_path(current_params)
|
||||
end
|
||||
|
||||
private
|
||||
@@ -50,8 +41,8 @@ module Admin
|
||||
params.require(:form_status_batch).permit(:action, status_ids: [])
|
||||
end
|
||||
|
||||
def set_account
|
||||
@account = Account.find(params[:account_id])
|
||||
def filtered_statuses
|
||||
StatusFilter.new(nil, nil, nil, filter_params).results
|
||||
end
|
||||
|
||||
def current_params
|
||||
@@ -63,6 +54,18 @@ module Admin
|
||||
}.select { |_, value| value.present? }
|
||||
end
|
||||
|
||||
def filter_params
|
||||
params.permit(
|
||||
:text,
|
||||
:id,
|
||||
:account_id,
|
||||
:group_id,
|
||||
:preview_card_id,
|
||||
:created_at_lte,
|
||||
:created_at_gte
|
||||
)
|
||||
end
|
||||
|
||||
def action_from_button
|
||||
if params[:nsfw_on]
|
||||
'nsfw_on'
|
||||
@@ -72,5 +75,6 @@ module Admin
|
||||
'delete'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user