@@ -344,19 +344,17 @@ def editable_by?(user_id)
344344 #
345345 # Returns Boolean
346346 def readable_by? ( user_id )
347+ return true if commentable_by? ( user_id )
347348 current_user = User . find ( user_id )
348- if current_user . present?
349- # If the user is a super admin and the config allows for supers to view plans
350- if current_user . can_super_admin? &&
351- Branding . fetch ( :service_configuration , :plans , :super_admins_read_all )
352- true
353- # If the user is an org admin and the config allows for org admins to view plans
354- elsif current_user . can_org_admin? &&
355- Branding . fetch ( :service_configuration , :plans , :org_admins_read_all )
356- owner_and_coowners . map ( &:org_id ) . include? ( current_user . org_id )
357- else
358- commentable_by? ( user_id )
359- end
349+ return false unless current_user . present?
350+ # If the user is a super admin and the config allows for supers to view plans
351+ if current_user . can_super_admin? &&
352+ Branding . fetch ( :service_configuration , :plans , :super_admins_read_all )
353+ true
354+ # If the user is an org admin and the config allows for org admins to view plans
355+ elsif current_user . can_org_admin? &&
356+ Branding . fetch ( :service_configuration , :plans , :org_admins_read_all )
357+ owner_and_coowners . map ( &:org_id ) . include? ( current_user . org_id )
360358 else
361359 false
362360 end
@@ -388,6 +386,7 @@ def administerable_by?(user_id)
388386 def reviewable_by? ( user_id )
389387 reviewer = User . find ( user_id )
390388 feedback_requested? &&
389+ reviewer . present? &&
391390 reviewer . org_id == owner . org_id &&
392391 reviewer . can_review_plans?
393392 end
0 commit comments