diff --git a/.env.development b/.env.development index 63be65d36..adc41c8ad 100644 --- a/.env.development +++ b/.env.development @@ -16,8 +16,8 @@ MARKETING_SITE_BASE_URL=http://localhost:18000 ORDER_HISTORY_URL=localhost:1996/orders REFRESH_ACCESS_TOKEN_ENDPOINT=http://localhost:18000/login_refresh SEGMENT_KEY=null -SHOW_FULLNAME=false -SHOW_SETTINGS_LABEL=false +SHOW_FULLNAME='false' +SHOW_SETTINGS_LABEL='false' SITE_NAME=Open edX USER_INFO_COOKIE_NAME=edx-user-info LOGO_URL=https://edx-cdn.org/v3/default/logo.svg diff --git a/package-lock.json b/package-lock.json index 456c863a4..6f127c562 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,6 @@ "@fortawesome/free-regular-svg-icons": "6.5.1", "@fortawesome/free-solid-svg-icons": "6.5.1", "@fortawesome/react-fontawesome": "^0.2.0", - "@openedx/brand-openedx": "^1.2.3", "axios-mock-adapter": "1.22.0", "babel-polyfill": "6.26.0", "react-responsive": "8.2.0", @@ -4233,11 +4232,6 @@ "node": ">= 8" } }, - "node_modules/@openedx/brand-openedx": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@openedx/brand-openedx/-/brand-openedx-1.2.3.tgz", - "integrity": "sha512-Dn9CtpC8fovh++Xi4NF5NJoeR9yU2yXZnV9IujxIyGd/dn0Phq5t6dzJVfupwq09mpDnzJv7egA8Znz/3ljO+w==" - }, "node_modules/@openedx/frontend-build": { "version": "13.1.0", "resolved": "https://registry.npmjs.org/@openedx/frontend-build/-/frontend-build-13.1.0.tgz", diff --git a/src/Header.jsx b/src/Header.jsx index efa2aa111..9bb32b3c3 100644 --- a/src/Header.jsx +++ b/src/Header.jsx @@ -66,7 +66,7 @@ const Header = ({ intl }) => { { type: 'item', href: config.ACCOUNT_SETTINGS_URL, - content: config.SHOW_SETTINGS_LABEL ? intl.formatMessage(messages['header.user.menu.settings']) : intl.formatMessage(messages['header.user.menu.account']), + content: config.SHOW_SETTINGS_LABEL === 'true' ? intl.formatMessage(messages['header.user.menu.settings']) : intl.formatMessage(messages['header.user.menu.account']), }, { type: 'item', @@ -94,7 +94,7 @@ const Header = ({ intl }) => { ]; let name = null - if (authenticatedUser !== null && config.SHOW_FULLNAME) { + if (authenticatedUser !== null && config.SHOW_FULLNAME === 'true') { name = authenticatedUser.name } else if (authenticatedUser !== null) { name = authenticatedUser.username diff --git a/src/learning-header/AuthenticatedUserDropdown.jsx b/src/learning-header/AuthenticatedUserDropdown.jsx index 9149922e7..79ac7295c 100644 --- a/src/learning-header/AuthenticatedUserDropdown.jsx +++ b/src/learning-header/AuthenticatedUserDropdown.jsx @@ -9,7 +9,7 @@ import { Dropdown } from '@openedx/paragon'; import messages from './messages'; -const AuthenticatedUserDropdown = ({ intl, name }) => { +const AuthenticatedUserDropdown = ({ intl, username, name }) => { const dashboardMenuItem = ( {intl.formatMessage(messages.dashboard)} @@ -23,7 +23,7 @@ const AuthenticatedUserDropdown = ({ intl, name }) => { - {name} + {getConfig().SHOW_FULLNAME === 'true' ? name : username} @@ -32,7 +32,7 @@ const AuthenticatedUserDropdown = ({ intl, name }) => { {intl.formatMessage(messages.profile)} - {getConfig().SHOW_SETTINGS_LABEL ? intl.formatMessage(messages.settings) : intl.formatMessage(messages.account)} + {getConfig().SHOW_SETTINGS_LABEL === 'true' ? intl.formatMessage(messages.settings) : intl.formatMessage(messages.account)} { getConfig().ORDER_HISTORY_URL && ( @@ -50,6 +50,7 @@ const AuthenticatedUserDropdown = ({ intl, name }) => { AuthenticatedUserDropdown.propTypes = { intl: intlShape.isRequired, + username: PropTypes.string.isRequired, name: PropTypes.string.isRequired, }; diff --git a/src/learning-header/LearningHeader.jsx b/src/learning-header/LearningHeader.jsx index 43529a132..0153551c8 100644 --- a/src/learning-header/LearningHeader.jsx +++ b/src/learning-header/LearningHeader.jsx @@ -50,7 +50,8 @@ const LearningHeader = ({ {showUserDropdown && authenticatedUser && ( )} {showUserDropdown && !authenticatedUser && ( diff --git a/src/setupTest.js b/src/setupTest.js index 95e0e5866..32d00244a 100644 --- a/src/setupTest.js +++ b/src/setupTest.js @@ -32,6 +32,7 @@ process.env.MARKETING_SITE_BASE_URL = 'http://localhost:18000'; process.env.ORDER_HISTORY_URL = 'localhost:1996/orders'; process.env.REFRESH_ACCESS_TOKEN_ENDPOINT = 'http://localhost:18000/login_refresh'; process.env.SEGMENT_KEY = 'segment_whoa'; +process.env.SHOW_FULLNAME = false; process.env.SITE_NAME = 'edX'; process.env.USER_INFO_COOKIE_NAME = 'edx-user-info'; process.env.LOGO_URL = 'https://edx-cdn.org/v3/default/logo.svg'; @@ -48,6 +49,7 @@ class MockLoggingService { export const authenticatedUser = { userId: 'abc123', username: 'Mock User', + name: 'Mock User Name', roles: [], administrator: false, }; @@ -66,10 +68,12 @@ export function initializeMockApp() { CSRF_TOKEN_API_PATH: process.env.CSRF_TOKEN_API_PATH || null, LOGO_URL: process.env.LOGO_URL || null, SITE_NAME: process.env.SITE_NAME || null, + SHOW_FULLNAME: process.env.SHOW_FULLNAME || null, authenticatedUser: { userId: 'abc123', username: 'Mock User', + name: 'Mock User Name', roles: [], administrator: false, },