Skip to content

Commit

Permalink
feat: remove audit access to learning assistant chat (openedx#1280)
Browse files Browse the repository at this point in the history
* feat: remove audit access to la

* feat: remove audit access to la
  • Loading branch information
alangsto committed Jan 29, 2024
1 parent 25d746b commit 55e2332
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
13 changes: 3 additions & 10 deletions src/courseware/course/chat/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -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()
);

Expand Down
4 changes: 2 additions & 2 deletions src/courseware/course/chat/Chat.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 55e2332

Please sign in to comment.