about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/api/v1/statuses_controller.rb4
-rw-r--r--app/services/remove_status_service.rb4
2 files changed, 3 insertions, 5 deletions
diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb
index b0cc95118..c7c429bfb 100644
--- a/app/controllers/api/v1/statuses_controller.rb
+++ b/app/controllers/api/v1/statuses_controller.rb
@@ -100,9 +100,9 @@ class Api::V1::StatusesController < Api::BaseController
     @status = Status.where(account_id: current_user.account).find(params[:id])
     authorize @status, :destroy?
 
-    if !current_user.setting_unpublish_on_delete || !@status.published? || truthy_param?(:redraft)
+    if !(current_user.setting_unpublish_on_delete && @status.published?) || truthy_param?(:redraft)
       @status.discard
-      RemovalWorker.perform_async(@status.id, redraft: true, immediate: !current_user.setting_unpublish_on_delete)
+      RemovalWorker.perform_async(@status.id, redraft: true, unpublished: true)
       @status.account.statuses_count = @status.account.statuses_count - 1
     else
       RemovalWorker.perform_async(@status.id, redraft: true, unpublish: true)
diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb
index ca7f830ec..29c835051 100644
--- a/app/services/remove_status_service.rb
+++ b/app/services/remove_status_service.rb
@@ -19,8 +19,6 @@ class RemoveStatusService < BaseService
     @reblogs  = status.reblogs.includes(:account).to_a
     @options  = options
 
-    return unless status.published? || @options[:unpublished]
-
     RedisLock.acquire(lock_options) do |lock|
       if lock.acquired?
         remove_from_self if status.account.local? && !@options[:unpublish]
@@ -51,7 +49,7 @@ class RemoveStatusService < BaseService
     # original object being removed implicitly removes reblogs
     # of it. The Delete activity of the original is forwarded
     # separately.
-    return if !@account.local? || @options[:original_removed]
+    return if !@account.local? || @options[:original_removed] || !(status.published? || @options[:unpublished])
 
     remove_from_remote_followers
     remove_from_remote_affected