Adding routes to follow, unfollow, favourite and reblog (locally known models)

This commit is contained in:
Eugen Rochko
2016-03-06 12:51:55 +01:00
parent aab330eb2d
commit c605b828b5
4 changed files with 57 additions and 1 deletions

View File

@ -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