about summary refs log tree commit diff
path: root/app/controllers/api/statuses_controller.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-09-26 23:55:21 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-09-26 23:56:53 +0200
commit7e14eefc819ce27f45406452a4f8e2039d0f0886 (patch)
treea58bb240cff3a247b154362a0106369789a04ad1 /app/controllers/api/statuses_controller.rb
parent210362e66578dae32cbf169884d3c2905fe32cb7 (diff)
Replace logo, fix #57 - delete/unreblog/unfavourite API, fix #45 - app
registration API
Diffstat (limited to 'app/controllers/api/statuses_controller.rb')
-rw-r--r--app/controllers/api/statuses_controller.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/api/statuses_controller.rb b/app/controllers/api/statuses_controller.rb
index f68f298d8..44fb40bae 100644
--- a/app/controllers/api/statuses_controller.rb
+++ b/app/controllers/api/statuses_controller.rb
@@ -17,16 +17,33 @@ class Api::StatusesController < ApiController
     render action: :show
   end
 
+  def destroy
+    @status = Status.where(account_id: current_user.account).find(params[:id])
+    RemoveStatusService.new.(@status)
+    render_empty
+  end
+
   def reblog
     @status = ReblogService.new.(current_user.account, Status.find(params[:id])).reload
     render action: :show
   end
 
+  def unreblog
+    RemoveStatusService.new.(Status.where(account_id: current_user.account, reblog_of_id: params[:id]).first!)
+    @status = Status.find(params[:id])
+    render action: :show
+  end
+
   def favourite
     @status = FavouriteService.new.(current_user.account, Status.find(params[:id])).status.reload
     render action: :show
   end
 
+  def unfavourite
+    @status = UnfavouriteService.new.(current_user.account, Status.find(params[:id])).status.reload
+    render action: :show
+  end
+
   def home
     @statuses = Feed.new(:home, current_user.account).get(20, params[:max_id]).to_a
   end