diff options
author | Starfall <us@starfall.systems> | 2023-01-17 11:41:05 -0600 |
---|---|---|
committer | Starfall <us@starfall.systems> | 2023-01-17 11:41:05 -0600 |
commit | 1f9c919b8769f5b0a3424ef343e0049d33d656e3 (patch) | |
tree | 1853486629da4b3b76192fe8756e8d4f6d71adcb /app/services/suspend_account_service.rb | |
parent | 957c21273ff42d5b2b4a5e16b7869bbb09aeb865 (diff) | |
parent | 13227e1dafd308dfe1a3effc3379b766274809b3 (diff) |
Merge remote-tracking branch 'glitch/main'
Diffstat (limited to 'app/services/suspend_account_service.rb')
-rw-r--r-- | app/services/suspend_account_service.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index b8dc8d5e0..211544fea 100644 --- a/app/services/suspend_account_service.rb +++ b/app/services/suspend_account_service.rb @@ -3,10 +3,13 @@ class SuspendAccountService < BaseService include Payloadable + # Carry out the suspension of a recently-suspended account + # @param [Account] account Account to suspend def call(account) + return unless account.suspended? + @account = account - suspend! reject_remote_follows! distribute_update_actor! unmerge_from_home_timelines! @@ -16,10 +19,6 @@ class SuspendAccountService < BaseService private - def suspend! - @account.suspend! unless @account.suspended? - end - def reject_remote_follows! return if @account.local? || !@account.activitypub? @@ -76,10 +75,15 @@ class SuspendAccountService < BaseService styles.each do |style| case Paperclip::Attachment.default_options[:storage] when :s3 + # Prevent useless S3 calls if ACLs are disabled + next if ENV['S3_PERMISSION'] == '' + begin attachment.s3_object(style).acl.put(acl: 'private') rescue Aws::S3::Errors::NoSuchKey Rails.logger.warn "Tried to change acl on non-existent key #{attachment.s3_object(style).key}" + rescue Aws::S3::Errors::NotImplemented => e + Rails.logger.error "Error trying to change ACL on #{attachment.s3_object(style).key}: #{e.message}" end when :fog # Not supported |