12b935fadf
Conflicts: - `.github/dependabot.yml`: Updated upstream, removed in glitch-soc to disable noise. Kept removed. - `CODE_OF_CONDUCT.md`: Upstream updated to a new version of the covenant, but I have not read it yet, so kept unchanged. - `Gemfile.lock`: Not a real conflict, one upstream dependency updated textually too close to the glitch-soc only `hcaptcha` dependency. Applied upstream changes. - `app/controllers/admin/base_controller.rb`: Minor conflict due to glitch-soc's theming system. Applied upstream changes. - `app/controllers/application_controller.rb`: Minor conflict due to glitch-soc's theming system. Applied upstream changes. - `app/controllers/disputes/base_controller.rb`: Minor conflict due to glitch-soc's theming system. Applied upstream changes. - `app/controllers/relationships_controller.rb`: Minor conflict due to glitch-soc's theming system. Applied upstream changes. - `app/controllers/statuses_cleanup_controller.rb`: Minor conflict due to glitch-soc's theming system. Applied upstream changes. - `app/helpers/application_helper.rb`: Minor conflict due to glitch-soc's theming system. Applied upstream changes. - `app/javascript/mastodon/features/compose/components/compose_form.jsx`: Upstream added a highlight animation for onboarding, while we changed the max character limit. Applied our local changes on top of upstream's new version. - `app/views/layouts/application.html.haml`: Minor conflict due to glitch-soc's theming system. Applied upstream changes. - `stylelint.config.js`: Upstream added ignore paths, glitch-soc had extra ignore paths. Added the same paths as upstream.
57 lines
1.4 KiB
Ruby
57 lines
1.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class Filters::StatusesController < ApplicationController
|
|
layout 'admin'
|
|
|
|
before_action :authenticate_user!
|
|
before_action :set_filter
|
|
before_action :set_status_filters
|
|
before_action :set_pack
|
|
before_action :set_body_classes
|
|
before_action :set_cache_headers
|
|
|
|
PER_PAGE = 20
|
|
|
|
def index
|
|
@status_filter_batch_action = Form::StatusFilterBatchAction.new
|
|
end
|
|
|
|
def batch
|
|
@status_filter_batch_action = Form::StatusFilterBatchAction.new(status_filter_batch_action_params.merge(current_account: current_account, filter_id: params[:filter_id], type: action_from_button))
|
|
@status_filter_batch_action.save!
|
|
rescue ActionController::ParameterMissing
|
|
flash[:alert] = I18n.t('admin.statuses.no_status_selected')
|
|
ensure
|
|
redirect_to edit_filter_path(@filter)
|
|
end
|
|
|
|
private
|
|
|
|
def set_pack
|
|
use_pack 'admin'
|
|
end
|
|
|
|
def set_filter
|
|
@filter = current_account.custom_filters.find(params[:filter_id])
|
|
end
|
|
|
|
def set_status_filters
|
|
@status_filters = @filter.statuses.preload(:status).page(params[:page]).per(PER_PAGE)
|
|
end
|
|
|
|
def status_filter_batch_action_params
|
|
params.require(:form_status_filter_batch_action).permit(status_filter_ids: [])
|
|
end
|
|
|
|
def action_from_button
|
|
'remove' if params[:remove]
|
|
end
|
|
|
|
def set_body_classes
|
|
@body_classes = 'admin'
|
|
end
|
|
|
|
def set_cache_headers
|
|
response.cache_control.replace(private: true, no_store: true)
|
|
end
|
|
end
|