From e9faf70611f936428d3b7ea8b6dfd30ade3d1428 Mon Sep 17 00:00:00 2001
From: pabois <pierreandre.boissinot@noesya.coop>
Date: Thu, 9 Mar 2023 11:39:16 +0100
Subject: [PATCH] more readable

---
 app/models/user/with_registration_context.rb | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/app/models/user/with_registration_context.rb b/app/models/user/with_registration_context.rb
index 750347e2a..476427a9d 100644
--- a/app/models/user/with_registration_context.rb
+++ b/app/models/user/with_registration_context.rb
@@ -19,8 +19,15 @@ module User::WithRegistrationContext
     end
 
     def user_can_access_registration_context?
-      (registration_context.has_feature?(:alumni) && registration_context.alumni.where(email: email).any?) ||
-        (registration_context.has_feature?(:contacts) && registration_context.connected_persons.where(email: email).any?)
+      user_is_alumni? || user_is_contact?
+    end
+
+    def user_is_alumni?
+      registration_context.has_feature?(:alumni) && registration_context.alumni.where(email: email).any?
+    end
+
+    def user_is_contact?
+      registration_context.has_feature?(:contacts) && registration_context.connected_persons.where(email: email).any?
     end
 
   end
-- 
GitLab