From 3554d638b31aa5ace2aa524db0165932c15d9a71 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 6 Oct 2016 21:27:58 +0200 Subject: Fix #72 - add follow/unfollow button to public profiles --- app/controllers/accounts_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/controllers') 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 -- cgit