From f84239ecabf5d92d0275894ee357e58af0a4e711 Mon Sep 17 00:00:00 2001 From: ThibG Date: Sat, 7 Nov 2020 13:16:00 +0100 Subject: Fix suspension/unsuspension not working because of FeedManager change (#15099) --- app/services/suspend_account_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/services/suspend_account_service.rb') diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index 5a079c3ac..ea96767fa 100644 --- a/app/services/suspend_account_service.rb +++ b/app/services/suspend_account_service.rb @@ -18,7 +18,7 @@ class SuspendAccountService < BaseService def unmerge_from_home_timelines! @account.followers_for_local_distribution.find_each do |follower| - FeedManager.instance.unmerge_from_timeline(@account, follower) + FeedManager.instance.unmerge_from_home(@account, follower) end end -- cgit From ee8cf246cfe8e05914ad7dcf81596f8535b3e161 Mon Sep 17 00:00:00 2001 From: ThibG Date: Sat, 7 Nov 2020 13:16:54 +0100 Subject: Fix crashes in SuspendAccountService/UnsuspendAccountService (#15100) * Fix crashes in SuspendAccountService/UnsuspendAccountService * Catch filesystem errors --- app/services/suspend_account_service.rb | 8 ++++++-- app/services/unsuspend_account_service.rb | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'app/services/suspend_account_service.rb') diff --git a/app/services/suspend_account_service.rb b/app/services/suspend_account_service.rb index ea96767fa..f08c41e17 100644 --- a/app/services/suspend_account_service.rb +++ b/app/services/suspend_account_service.rb @@ -39,11 +39,15 @@ class SuspendAccountService < BaseService styles.each do |style| case Paperclip::Attachment.default_options[:storage] when :s3 - attachment.s3_object(style).acl.put(:private) + attachment.s3_object(style).acl.put(acl: 'private') when :fog # Not supported when :filesystem - FileUtils.chmod(0o600 & ~File.umask, attachment.path(style)) + begin + FileUtils.chmod(0o600 & ~File.umask, attachment.path(style)) unless attachment.path(style).nil? + rescue Errno::ENOENT + Rails.logger.warn "Tried to change permission on non-existent file #{attachment.path(style)}" + end end end end diff --git a/app/services/unsuspend_account_service.rb b/app/services/unsuspend_account_service.rb index fe49e3471..91dbc9c18 100644 --- a/app/services/unsuspend_account_service.rb +++ b/app/services/unsuspend_account_service.rb @@ -39,11 +39,15 @@ class UnsuspendAccountService < BaseService styles.each do |style| case Paperclip::Attachment.default_options[:storage] when :s3 - attachment.s3_object(style).acl.put(Paperclip::Attachment.default_options[:s3_permissions]) + attachment.s3_object(style).acl.put(acl: Paperclip::Attachment.default_options[:s3_permissions]) when :fog # Not supported when :filesystem - FileUtils.chmod(0o666 & ~File.umask, attachment.path(style)) + begin + FileUtils.chmod(0o666 & ~File.umask, attachment.path(style)) unless attachment.path(style).nil? + rescue Errno::ENOENT + Rails.logger.warn "Tried to change permission on non-existent file #{attachment.path(style)}" + end end end end -- cgit