diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-08-10 00:25:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-10 00:25:33 +0200 |
commit | 70b7ac9ff32a713e71a7ba6408a379b601c6839f (patch) | |
tree | f048b304f0d4f0f49e51c2edb8b74ccae6ac89e6 /app/controllers | |
parent | a61645ed30b854a1b4935026801eb5b287954095 (diff) | |
parent | 8681ef85d0728b9d34dc62785fab6fcec30ba95c (diff) |
Merge pull request #1583 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/statuses_cleanup_controller.rb | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/app/controllers/statuses_cleanup_controller.rb b/app/controllers/statuses_cleanup_controller.rb new file mode 100644 index 000000000..3d4f4af02 --- /dev/null +++ b/app/controllers/statuses_cleanup_controller.rb @@ -0,0 +1,40 @@ +# 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 + + 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 |