From 5a94cc667bac854a05261bedac7ce85a7ed73953 Mon Sep 17 00:00:00 2001 From: Fire Demon Date: Wed, 21 Oct 2020 20:19:02 -0500 Subject: When unpublishing, defederate post before setting it local-only --- app/services/remove_status_service.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index 29c835051..d7bd2ae39 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -33,12 +33,7 @@ class RemoveStatusService < BaseService remove_from_spam_check unless @options[:unpublish] remove_media unless @options[:unpublish] - if @options[:immediate] || !(@options[:unpublish] || @status.reported?) - @status.destroy! - else - @status.update(published: false, expires_at: nil, local_only: @status.local?) - DistributionWorker.perform_async(@status.id) if @status.local? - end + @status.destroy! if @options[:immediate] || !(@options[:unpublish] || @status.reported?) else raise Mastodon::RaceConditionError end @@ -54,6 +49,11 @@ class RemoveStatusService < BaseService remove_from_remote_followers remove_from_remote_affected remove_from_remote_shared + + return unless @options[:unpublish] + + @status.update(published: false, expires_at: nil, local_only: @status.local?) + DistributionWorker.perform_async(@status.id) if @status.local? end private -- cgit