Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
fix: apply the pattern current_user.blank? to Event, Option & Questio…
Browse files Browse the repository at this point in the history
…n show? policies
  • Loading branch information
darccio committed Feb 21, 2023
1 parent 97fd819 commit 2d74128
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/policies/event_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def destroy?
end

def show?
return false if current_user.blank?

record.consultation_id == current_user.consultation_id
end

Expand Down
2 changes: 2 additions & 0 deletions app/policies/option_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def destroy?
end

def show?
return false if current_user.blank?

record.question.consultation_id == current_user.consultation_id
end

Expand Down
2 changes: 2 additions & 0 deletions app/policies/question_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ def close?
end

def show?
return false if current_user.blank?

record.consultation_id == current_user.consultation_id
end

Expand Down

0 comments on commit 2d74128

Please sign in to comment.