Do not display send notification button when proposal is from another author.

This commit is contained in:
taitus
2017-07-13 18:39:17 +02:00
committed by Senén Rodero Rodríguez
parent 556e2598c3
commit b0c571e658
3 changed files with 5 additions and 10 deletions

View File

@@ -4,7 +4,6 @@ class UsersController < ApplicationController
load_and_authorize_resource
helper_method :author?
helper_method :valid_interests_access?
helper_method :author_or_admin?
def show
load_filtered_activity if valid_access?
@@ -81,12 +80,8 @@ class UsersController < ApplicationController
@user.public_interests || authorized_current_user?
end
def author?
@author ||= current_user && (current_user == @user)
end
def author_or_admin?
@author_or_admin ||= current_user && (author? || current_user.administrator?)
def author?(proposal)
proposal.author_id == current_user.id
end
def authorized_current_user?