From 55e2332b0035c183104ad54814456e9d7a1e8fe0 Mon Sep 17 00:00:00 2001 From: alangsto <46360176+alangsto@users.noreply.github.com> Date: Mon, 29 Jan 2024 17:08:17 -0500 Subject: [PATCH] feat: remove audit access to learning assistant chat (#1280) * feat: remove audit access to la * feat: remove audit access to la --- src/courseware/course/chat/Chat.jsx | 13 +++---------- src/courseware/course/chat/Chat.test.jsx | 4 ++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/courseware/course/chat/Chat.jsx b/src/courseware/course/chat/Chat.jsx index afeacccd1b..cddfbc1ddf 100644 --- a/src/courseware/course/chat/Chat.jsx +++ b/src/courseware/course/chat/Chat.jsx @@ -24,17 +24,10 @@ const Chat = ({ 'paid-bootcamp', ]; - const AUDIT_MODES = [ - 'audit', - 'honor', - 'unpaid-executive-education', - 'unpaid-bootcamp', - ]; - - const isEnrolled = ( + const hasVerifiedEnrollment = ( enrollmentMode !== null && enrollmentMode !== undefined - && [...VERIFIED_MODES, ...AUDIT_MODES].some(mode => mode === enrollmentMode) + && [...VERIFIED_MODES].some(mode => mode === enrollmentMode) ); const endDatePassed = () => { @@ -46,7 +39,7 @@ const Chat = ({ const shouldDisplayChat = ( enabled - && (isEnrolled || isStaff) // display only to enrolled or staff + && (hasVerifiedEnrollment || isStaff) // display only to verified learners or staff && !endDatePassed() ); diff --git a/src/courseware/course/chat/Chat.test.jsx b/src/courseware/course/chat/Chat.test.jsx index 3045559b11..31085c54df 100644 --- a/src/courseware/course/chat/Chat.test.jsx +++ b/src/courseware/course/chat/Chat.test.jsx @@ -16,9 +16,9 @@ let enabledTestCases = []; let disabledTestCases = []; const enabledModes = [ 'professional', 'verified', 'no-id-professional', 'credit', 'masters', 'executive-education', - 'paid-executive-education', 'paid-bootcamp', 'audit', 'honor', 'unpaid-executive-education', 'unpaid-bootcamp', + 'paid-executive-education', 'paid-bootcamp', ]; -const disabledModes = [null, undefined, 'xyz']; +const disabledModes = [null, undefined, 'xyz', 'audit', 'honor', 'unpaid-executive-education', 'unpaid-bootcamp']; const currentTime = new Date(); describe('Chat', () => {