feat: Use messages field from API
When fetching details for discussion providers from the API, the `messages` field is used if available and displayed in the configuration page for each provider. Related tickets: * [TNL-8339](https://openedx.atlassian.net/browse/TNL-8339) * [BB-4249 (OpenCraft Internal)](https://tasks.opencraft.com/browse/BB-4249)
This commit is contained in:
committed by
Awais Jibran
parent
b0fd539770
commit
76b2d5929c
@@ -56,6 +56,9 @@ function LtiConfigForm({
|
||||
<Form ref={formRef} onSubmit={handleSubmit}>
|
||||
<h3 className="mb-3">{title}</h3>
|
||||
<p>{intl.formatMessage(messages.formInstructions)}</p>
|
||||
{app.messages && app.messages.map(msg => (
|
||||
<p key={msg}>{msg}</p>
|
||||
))}
|
||||
<Form.Group controlId="consumerKey" isInvalid={isInvalidConsumerKey} className="mb-4">
|
||||
<Form.Control
|
||||
floatingLabel={intl.formatMessage(messages.consumerKey)}
|
||||
@@ -111,6 +114,7 @@ LtiConfigForm.propTypes = {
|
||||
accessibility: PropTypes.string,
|
||||
contactEmail: PropTypes.string,
|
||||
}).isRequired,
|
||||
messages: PropTypes.arrayOf(PropTypes.string),
|
||||
}).isRequired,
|
||||
appConfig: PropTypes.shape({
|
||||
consumerKey: PropTypes.string,
|
||||
|
||||
@@ -46,6 +46,7 @@ function normalizePluginConfig(data) {
|
||||
function normalizeApps(data) {
|
||||
const apps = Object.entries(data.providers.available).map(([key, app]) => ({
|
||||
id: key,
|
||||
messages: app.messages,
|
||||
featureIds: app.features,
|
||||
// TODO: Fix this and get it from the backend!
|
||||
externalLinks: {
|
||||
|
||||
@@ -51,6 +51,7 @@ const legacyApp = {
|
||||
contactEmail: '',
|
||||
},
|
||||
hasFullSupport: false,
|
||||
messages: [],
|
||||
};
|
||||
|
||||
const piazzaApp = {
|
||||
@@ -69,6 +70,7 @@ const piazzaApp = {
|
||||
contactEmail: '',
|
||||
},
|
||||
hasFullSupport: true,
|
||||
messages: [],
|
||||
};
|
||||
|
||||
let axiosMock;
|
||||
|
||||
@@ -31,6 +31,7 @@ export const piazzaApiResponse = {
|
||||
accessibility: '',
|
||||
contact_email: '',
|
||||
},
|
||||
messages: [],
|
||||
},
|
||||
piazza: {
|
||||
features: [
|
||||
@@ -47,6 +48,7 @@ export const piazzaApiResponse = {
|
||||
accessibility: '',
|
||||
contact_email: '',
|
||||
},
|
||||
messages: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -98,6 +100,7 @@ export const legacyApiResponse = {
|
||||
accessibility: '',
|
||||
contact_email: '',
|
||||
},
|
||||
messages: [],
|
||||
},
|
||||
piazza: {
|
||||
features: [
|
||||
@@ -114,6 +117,7 @@ export const legacyApiResponse = {
|
||||
accessibility: '',
|
||||
contact_email: '',
|
||||
},
|
||||
messages: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user