about summary refs log tree commit diff
path: root/app/controllers
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-29 15:32:25 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-29 15:32:25 +0100
commit93a90cd9c364680cfcc4c1d1ada13efed233e5bd (patch)
tree58f1444eeb9daa829b971fade2b9c0343c37e825 /app/controllers
parent5973ca3d111e65385299d47b6b82df48a0a5f67b (diff)
Delete statuses asynchronously but provide instant feedback in the API
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/api/v1/statuses_controller.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb
index a693ce00d..a0b15cfbc 100644
--- a/app/controllers/api/v1/statuses_controller.rb
+++ b/app/controllers/api/v1/statuses_controller.rb
@@ -58,7 +58,7 @@ class Api::V1::StatusesController < ApiController
 
   def destroy
     @status = Status.where(account_id: current_user.account).find(params[:id])
-    RemoveStatusService.new.call(@status)
+    RemovalWorker.perform_async(@status.id)
     render_empty
   end
 
@@ -68,8 +68,12 @@ class Api::V1::StatusesController < ApiController
   end
 
   def unreblog
-    RemoveStatusService.new.call(Status.where(account_id: current_user.account, reblog_of_id: params[:id]).first!)
-    @status = Status.find(params[:id])
+    reblog         = Status.where(account_id: current_user.account, reblog_of_id: params[:id]).first!
+    @status        = reblog.reblog
+    @reblogged_map = { @status.id => false }
+
+    RemovalWorker.perform_async(reblog.id)
+    
     render action: :show
   end