diff --git a/src/pages-and-resources/live/Settings.jsx b/src/pages-and-resources/live/Settings.jsx index 6a11217c6..90f380165 100644 --- a/src/pages-and-resources/live/Settings.jsx +++ b/src/pages-and-resources/live/Settings.jsx @@ -74,39 +74,45 @@ function LiveSettings({ ))} - <> -

- {intl.formatMessage(messages.providerHelperText, { providerName: values.provider })} + {values.piiSharingEnable ? ( + <> +

+ {intl.formatMessage(messages.providerHelperText, { providerName: values.provider })} +

+

{intl.formatMessage(messages.formInstructions)}

+ + + + + + ) : ( +

+ {intl.formatMessage(messages.requestPiiSharingEnable, { provider: values.provider })}

-

{intl.formatMessage(messages.formInstructions)}

- - - - - + )} ) } diff --git a/src/pages-and-resources/live/Settings.test.jsx b/src/pages-and-resources/live/Settings.test.jsx index 7d741e2c0..727079f44 100644 --- a/src/pages-and-resources/live/Settings.test.jsx +++ b/src/pages-and-resources/live/Settings.test.jsx @@ -97,7 +97,7 @@ describe('LiveSettings', () => { const fetchProviderConfigUrl = `${providerConfigurationApiUrl}/${courseId}/`; axiosMock.onGet(fetchProviderConfigUrl).reply( 200, - generateLiveConfigurationApiResponse(false), + generateLiveConfigurationApiResponse(false, false), ); await executeThunk(fetchLiveConfiguration(courseId), store.dispatch); renderComponent(); @@ -114,7 +114,7 @@ describe('LiveSettings', () => { const fetchProviderConfigUrl = `${providerConfigurationApiUrl}/${courseId}/`; axiosMock.onGet(fetchProviderConfigUrl).reply( 200, - generateLiveConfigurationApiResponse(false), + generateLiveConfigurationApiResponse(false, true), ); await executeThunk(fetchLiveConfiguration(courseId), store.dispatch); renderComponent(); @@ -129,7 +129,7 @@ describe('LiveSettings', () => { ); }); - test('Displays helper text and lti fields for selected provider', async () => { + test('Only helper text and lti fields are visible when pii sharing is enabled', async () => { const fetchProviderConfigUrl = `${providerConfigurationApiUrl}/${courseId}/`; axiosMock.onGet(fetchProviderConfigUrl).reply( 200, @@ -153,6 +153,30 @@ describe('LiveSettings', () => { expect(launchEmail.lastChild).toHaveTextContent(messages.launchEmail.defaultMessage); }); + test('Only connect to support is visible when pii sharing is disabled', async () => { + const fetchProviderConfigUrl = `${providerConfigurationApiUrl}/${courseId}/`; + axiosMock.onGet(fetchProviderConfigUrl).reply( + 200, + generateLiveConfigurationApiResponse(false, false), + ); + await executeThunk(fetchLiveConfiguration(courseId), store.dispatch); + renderComponent(); + + const requestPiiText = queryByTestId(container, 'request-pii-sharing'); + const consumerKey = container.querySelector('input[name="consumerKey"]'); + const consumerSecret = container.querySelector('input[name="consumerSecret"]'); + const launchUrl = container.querySelector('input[name="launchUrl"]'); + const launchEmail = container.querySelector('input[name="launchEmail"]'); + + expect(requestPiiText).toHaveTextContent( + messages.requestPiiSharingEnable.defaultMessage.replaceAll('{provider}', 'zoom'), + ); + expect(consumerKey).not.toBeInTheDocument(); + expect(consumerSecret).not.toBeInTheDocument(); + expect(launchUrl).not.toBeInTheDocument(); + expect(launchEmail).not.toBeInTheDocument(); + }); + test('Form should be submitted and closed when valid data is provided', async () => { const fetchProviderConfigUrl = `${providerConfigurationApiUrl}/${courseId}/`; const apiDefaultResponse = generateLiveConfigurationApiResponse(); diff --git a/src/pages-and-resources/live/data/thunks.js b/src/pages-and-resources/live/data/thunks.js index 2603c9695..f57021d5e 100644 --- a/src/pages-and-resources/live/data/thunks.js +++ b/src/pages-and-resources/live/data/thunks.js @@ -15,6 +15,7 @@ function normalizeLiveConfig(config) { configuration.launchUrl = config?.ltiConfiguration?.lti1P1LaunchUrl || ''; configuration.launchEmail = config?.ltiConfiguration?.ltiConfig?.additionalParameters?.customInstructorEmail || ''; configuration.provider = config?.providerType || 'zoom'; + configuration.piiSharingEnable = config?.piiSharingAllowed || false; return configuration; } @@ -34,6 +35,7 @@ function deNormalizeLiveConfig(config) { }, }, }; + configuration.pii_sharing_allowed = config?.piiSharingEnable || false; return configuration; } diff --git a/src/pages-and-resources/live/factories/mockApiResponses.jsx b/src/pages-and-resources/live/factories/mockApiResponses.jsx index c882c41cb..ab7f2c2fd 100644 --- a/src/pages-and-resources/live/factories/mockApiResponses.jsx +++ b/src/pages-and-resources/live/factories/mockApiResponses.jsx @@ -56,6 +56,7 @@ export const initialState = { launchUrl: '', launchEmail: '', provider: 'zoom', + piiSharingEnable: true, }, saveStatus: 'successful', configuredProvider: 'zoom', @@ -64,6 +65,7 @@ export const initialState = { export const generateLiveConfigurationApiResponse = ( enabled = true, + piiSharingAllowed = true, ) => ({ course_key: courseId, provider_type: 'zoom', @@ -79,4 +81,5 @@ export const generateLiveConfigurationApiResponse = ( }, }, }, + pii_sharing_allowed: piiSharingAllowed, }); diff --git a/src/pages-and-resources/live/messages.js b/src/pages-and-resources/live/messages.js index 5280acc33..b18d3fe84 100644 --- a/src/pages-and-resources/live/messages.js +++ b/src/pages-and-resources/live/messages.js @@ -91,6 +91,11 @@ const messages = defineMessages({ defaultMessage: 'This configuration will require sharing username and emails of learners and the course team with {providerName}.', description: 'Tells the user that sharing username and email is required for configuration', }, + requestPiiSharingEnable: { + id: 'authoring.live.requestPiiSharingEnable', + defaultMessage: 'This configuration will require sharing usernames and emails of learners and the course team with {provider}. To access the LTI configuration for {provider}, please request your edX project coordinator to get PII sharing enabled for this course.', + description: 'Tells the user that request edx project coordinator to enable the PII sharing to access the LTI configuration for a provider.', + }, general: { id: 'authoring.live.appDocInstructions.documentationLink', defaultMessage: 'General documentation',