Fix local follows, 404 in logs
This commit is contained in:
@ -19,12 +19,7 @@ class Api::AccountsController < ApiController
|
||||
end
|
||||
|
||||
def follow
|
||||
if @account.local?
|
||||
@follow = current_user.account.follow!(@account)
|
||||
else
|
||||
@follow = FollowService.new.(current_user.account, @account.acct)
|
||||
end
|
||||
|
||||
@follow = FollowService.new.(current_user.account, @account.acct)
|
||||
render action: :show
|
||||
end
|
||||
|
||||
|
@ -7,8 +7,21 @@ class ApplicationController < ActionController::Base
|
||||
|
||||
helper_method :current_account
|
||||
|
||||
rescue_from ActionController::RoutingError, with: :not_found
|
||||
rescue_from ActiveRecord::RecordNotFound, with: :not_found
|
||||
|
||||
def raise_not_found
|
||||
raise ActionController::RoutingError.new("No route matches #{params[:unmatched_route]}")
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def not_found
|
||||
respond_to do |format|
|
||||
format.any { head 404 }
|
||||
end
|
||||
end
|
||||
|
||||
def current_account
|
||||
current_user.try(:account)
|
||||
end
|
||||
|
Reference in New Issue
Block a user