mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 08:11:37 +01:00
aec61a703f
Conflicts: - `.github/workflows/build-image.yml`: Upstream changed how docker images were built, including how they were cached. I don't know much about it, so applied upstream's changes. - `app/controllers/admin/domain_blocks_controller.rb`: The feature, that was in glitch-soc, got backported upstream. It also had a few fixes upstream, so those have been ported! - `app/javascript/packs/admin.js`: Glitch-soc changes have been backported upstream. As a result, some code from `app/javascript/core/admin.js` got added upstream. Kept our version since our shared Javascript already has that feature. - `app/models/user.rb`: Upstream added something to distinguish unusable and unusable-because-moved accounts, while glitch-soc considers moved accounts usable. Took upstream's code for `functional_or_moved?` and made `functional?` call it. - `app/views/statuses/_simple_status.html.haml`: Upstream cleaned up code style a bit, on a line that we had custom changes for. Applied upstream's change while keeping our change. - `config/initializers/content_security_policy.rb`: Upstream adopted one CSP directive we already had. The conflict is because of our files being structurally different, but the change itself was already part of glitch-soc. Kept our version.
44 lines
1.1 KiB
Ruby
44 lines
1.1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class StatusesCleanupController < ApplicationController
|
|
layout 'admin'
|
|
|
|
before_action :authenticate_user!
|
|
before_action :set_policy
|
|
before_action :set_body_classes
|
|
before_action :set_pack
|
|
|
|
def show; end
|
|
|
|
def update
|
|
if @policy.update(resource_params)
|
|
redirect_to statuses_cleanup_path, notice: I18n.t('generic.changes_saved_msg')
|
|
else
|
|
render action: :show
|
|
end
|
|
rescue ActionController::ParameterMissing
|
|
# Do nothing
|
|
end
|
|
|
|
def require_functional!
|
|
redirect_to edit_user_registration_path unless current_user.functional_or_moved?
|
|
end
|
|
|
|
private
|
|
|
|
def set_pack
|
|
use_pack 'settings'
|
|
end
|
|
|
|
def set_policy
|
|
@policy = current_account.statuses_cleanup_policy || current_account.build_statuses_cleanup_policy(enabled: false)
|
|
end
|
|
|
|
def resource_params
|
|
params.require(:account_statuses_cleanup_policy).permit(:enabled, :min_status_age, :keep_direct, :keep_pinned, :keep_polls, :keep_media, :keep_self_fav, :keep_self_bookmark, :min_favs, :min_reblogs)
|
|
end
|
|
|
|
def set_body_classes
|
|
@body_classes = 'admin'
|
|
end
|
|
end
|