about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-10-21 20:19:02 -0500
committerFire Demon <firedemon@creature.cafe>2020-10-21 20:19:02 -0500
commit5a94cc667bac854a05261bedac7ce85a7ed73953 (patch)
tree384ef3573b36ad53351a0c92f41e5c49ac14fd29
parent5869ca06f95d5f9e87f5ed50349395a399ae73f0 (diff)
When unpublishing, defederate post before setting it local-only
-rw-r--r--app/services/remove_status_service.rb12
1 files 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