Add public interests validation and show interests on user profile
This commit is contained in:
committed by
Senén Rodero Rodríguez
parent
bce28afe36
commit
19820e4432
@@ -7,6 +7,7 @@ class UsersController < ApplicationController
|
||||
|
||||
def show
|
||||
load_filtered_activity if valid_access?
|
||||
load_interest if valid_interest_access?
|
||||
end
|
||||
|
||||
private
|
||||
@@ -62,10 +63,18 @@ class UsersController < ApplicationController
|
||||
@budget_investments = Budget::Investment.where(author_id: @user.id).order(created_at: :desc).page(params[:page])
|
||||
end
|
||||
|
||||
def load_interest
|
||||
@interests = Follow.interests_by(@user)
|
||||
end
|
||||
|
||||
def valid_access?
|
||||
@user.public_activity || authorized_current_user?
|
||||
end
|
||||
|
||||
def valid_interest_access?
|
||||
@user.public_interests || authorized_current_user?
|
||||
end
|
||||
|
||||
def author?
|
||||
@author ||= current_user && (current_user == @user)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user