diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-06 12:51:55 +0100 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2016-03-06 12:51:55 +0100 |
commit | c605b828b53165cb0161a1885e03202013b63f52 (patch) | |
tree | a667e98afc79ca3eaa49f46955529f4dc5f2f101 /app/controllers/accounts_controller.rb | |
parent | aab330eb2d39711e19753e89ba7ff67521929cf0 (diff) |
Adding routes to follow, unfollow, favourite and reblog (locally known models)
Diffstat (limited to 'app/controllers/accounts_controller.rb')
-rw-r--r-- | app/controllers/accounts_controller.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 156926927..9e2e160b2 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -3,6 +3,7 @@ class AccountsController < ApplicationController before_action :set_account before_action :set_webfinger_header + before_action :authenticate_user!, only: [:follow, :unfollow] def show @statuses = @account.statuses.order('id desc').includes(thread: [:account], reblog: [:account], stream_entry: []) @@ -13,6 +14,16 @@ class AccountsController < ApplicationController end end + def follow + current_user.account.follow!(@account) + redirect_to root_path + end + + def unfollow + current_user.account.unfollow!(@account) + redirect_to root_path + end + private def set_account |