about summary refs log tree commit diff
path: root/app/controllers/accounts_controller.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-10-06 21:27:58 +0200
committerEugen Rochko <eugen@zeonfederated.com>2016-10-06 21:27:58 +0200
commit3554d638b31aa5ace2aa524db0165932c15d9a71 (patch)
treed20d71469f6077daf83a6996f4143dd393924b68 /app/controllers/accounts_controller.rb
parent87ba52ad3f1e32b0608bb6c6ffb226c1988267a3 (diff)
Fix #72 - add follow/unfollow button to public profiles
Diffstat (limited to 'app/controllers/accounts_controller.rb')
-rw-r--r--app/controllers/accounts_controller.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb
index 9f4751771..b16938845 100644
--- a/app/controllers/accounts_controller.rb
+++ b/app/controllers/accounts_controller.rb
@@ -16,6 +16,16 @@ class AccountsController < ApplicationController
     end
   end
 
+  def follow
+    FollowService.new.call(current_user.account, @account.acct)
+    redirect_to account_path(@account)
+  end
+
+  def unfollow
+    UnfollowService.new.call(current_user.account, @account)
+    redirect_to account_path(@account)
+  end
+
   def followers
     @followers = @account.followers.order('follows.created_at desc').paginate(page: params[:page], per_page: 6)
   end