diff --git a/.circleci/config.yml b/.circleci/config.yml index 9e756e116b..349c4c5d3c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -342,7 +342,7 @@ workflows: filters: branches: only: - - free + - develop # This is alternate dev env for parallel testing - "build-test": context : org-global diff --git a/__tests__/shared/components/Settings/Account/__snapshots__/index.jsx.snap b/__tests__/shared/components/Settings/Account/__snapshots__/index.jsx.snap index a893682b08..706a373936 100644 --- a/__tests__/shared/components/Settings/Account/__snapshots__/index.jsx.snap +++ b/__tests__/shared/components/Settings/Account/__snapshots__/index.jsx.snap @@ -10,12 +10,6 @@ exports[`renders account setting page correctly 1`] = ` , "my account": diff --git a/__tests__/shared/components/Settings/Account/index.jsx b/__tests__/shared/components/Settings/Account/index.jsx index ab7a1d2bc0..0bd72d407d 100644 --- a/__tests__/shared/components/Settings/Account/index.jsx +++ b/__tests__/shared/components/Settings/Account/index.jsx @@ -12,7 +12,7 @@ const settingsUI = { TABS: { ACCOUNT: { MYACCOUNT: 'my account', - LINKEDACCOUNT: 'linked account', + // LINKEDACCOUNT: 'linked account', }, }, }; diff --git a/src/shared/components/Settings/Account/LinkedAccount/AddWebLink.jsx b/src/shared/components/Settings/Account/LinkedAccount/AddWebLink.jsx index 168581561d..d807114ece 100644 --- a/src/shared/components/Settings/Account/LinkedAccount/AddWebLink.jsx +++ b/src/shared/components/Settings/Account/LinkedAccount/AddWebLink.jsx @@ -13,6 +13,7 @@ export default class AddWebLink extends React.Component { super(props); this.state = { webLink: '', + webLinkEmpty: false, }; this.onUpdateWebLink = this.onUpdateWebLink.bind(this); @@ -32,6 +33,11 @@ export default class AddWebLink extends React.Component { // Set web link onUpdateWebLink(e) { e.preventDefault(); + if (e.target.value) { + this.setState({ + webLinkEmpty: false, + }); + } this.setState({ webLink: e.target.value }); } @@ -62,6 +68,11 @@ export default class AddWebLink extends React.Component { tokenV3, } = this.props; const { webLink } = this.state; + if (!webLink) { + this.setState({ + webLinkEmpty: true, + }); + } if (webLink && this.isWebLinkValid() && !this.webLinkExist()) { addWebLink(handle, tokenV3, webLink); } @@ -82,7 +93,7 @@ export default class AddWebLink extends React.Component { } render() { - const { webLink } = this.state; + const { webLink, webLinkEmpty } = this.state; const webLinkValid = this.isWebLinkValid(); const webLinkExist = this.webLinkExist(); @@ -172,6 +183,15 @@ export default class AddWebLink extends React.Component { onKeyDown={this.onAddWebLink} required /> + { + webLinkEmpty && ( +
+

+ Please Enter External Link +

+
+ ) + } { !webLinkValid && !webLinkExist && ( diff --git a/src/shared/components/Settings/Account/LinkedAccount/index.jsx b/src/shared/components/Settings/Account/LinkedAccount/index.jsx index 216fd9f908..4c7008cd88 100644 --- a/src/shared/components/Settings/Account/LinkedAccount/index.jsx +++ b/src/shared/components/Settings/Account/LinkedAccount/index.jsx @@ -105,11 +105,13 @@ export default class LinkedAccount extends React.Component { if (!linkedAccounts.length) { const providers = _.omit(externalAccountsData, ['userId', 'updatedAt', 'createdAt', 'createdBy', 'updatedBy']); - _.forEach(_.keys(providers), (p) => { - if (providers[p]) { - linkedAccounts.push({ providerType: p }); - } - }); + if (_.keys(_.omitBy(providers, _.isNil)).length > 1) { + _.forEach(_.keys(providers), (p) => { + if (providers[p]) { + linkedAccounts.push({ providerType: p }); + } + }); + } } _.forEach(linkedAccounts, (linkedAccount) => { const providerType = linkedAccount.providerType || linkedAccount.provider; diff --git a/src/shared/components/Settings/Account/index.jsx b/src/shared/components/Settings/Account/index.jsx index 123dd15e55..003f736c75 100644 --- a/src/shared/components/Settings/Account/index.jsx +++ b/src/shared/components/Settings/Account/index.jsx @@ -8,12 +8,12 @@ import _ from 'lodash'; import Accordion from 'components/Settings/Accordion'; import MyAccountIcon from 'assets/images/account/sideicons/myaccount.svg'; -import LinkedAccountIcon from 'assets/images/account/sideicons/linkedaccount.svg'; +// import LinkedAccountIcon from 'assets/images/account/sideicons/linkedaccount.svg'; import ErrorWrapper from 'components/Settings/ErrorWrapper'; import SideBar from '../SideBar'; import ComingSoon from '../ComingSoon'; import MyAccount from './MyAccount'; -import LinkedAccount from './LinkedAccount'; +// import LinkedAccount from './LinkedAccount'; import { SCREEN_SIZE } from '../constants'; import './styles.scss'; @@ -74,14 +74,14 @@ export default class Account extends React.Component { const currentTab = this.tablink || settingsUI.currentAccountTab; const icons = { 'my account': , - 'linked accounts': , + // 'linked accounts': , }; const renderTabContent = (tab) => { switch (tab) { case 'my account': return ; - case 'linked accounts': - return ; + // case 'linked accounts': + // return ; default: return ; } diff --git a/src/shared/components/Settings/Profile/BasicInfo/index.jsx b/src/shared/components/Settings/Profile/BasicInfo/index.jsx index aa7e8c9711..1240cc2184 100644 --- a/src/shared/components/Settings/Profile/BasicInfo/index.jsx +++ b/src/shared/components/Settings/Profile/BasicInfo/index.jsx @@ -255,6 +255,10 @@ export default class BasicInfo extends ConsentComponent { case 'streetAddr2': newBasicInfo.addresses[0][e.target.name] = e.target.value; break; + case 'firstName': + case 'lastName': + newBasicInfo[e.target.name] = e.target.value.replace(/[^a-zA-Z0-9,. -]/g, ''); + break; default: newBasicInfo[e.target.name] = e.target.value; } diff --git a/src/shared/components/Settings/Profile/Education/index.jsx b/src/shared/components/Settings/Profile/Education/index.jsx index ffc9d7cecb..7df00f3408 100644 --- a/src/shared/components/Settings/Profile/Education/index.jsx +++ b/src/shared/components/Settings/Profile/Education/index.jsx @@ -181,12 +181,10 @@ export default class Education extends ConsentComponent { } onUpdateDate(date, timePeriod) { - if (date) { - const { newEducation: oldEducation } = this.state; - const newEducation = { ...oldEducation }; - newEducation[timePeriod] = date; - this.setState({ newEducation, isSubmit: false }); - } + const { newEducation: oldEducation } = this.state; + const newEducation = { ...oldEducation }; + newEducation[timePeriod] = date || ''; + this.setState({ newEducation, isSubmit: false }); } /** @@ -530,6 +528,7 @@ export default class Education extends ConsentComponent {
{ - toastr.error('Looks like you\'ve already entered this device.'); - }); - return; + const deviceItems = deviceTrait.traits + ? deviceTrait.traits.data.slice() : []; + let exist = false; + // eslint-disable-next-line no-restricted-syntax + for (const item of deviceItems) { + if (item.deviceType === newDevice.deviceType + && item.manufacturer === newDevice.manufacturer + && item.model === newDevice.model + && item.operatingSystem === newDevice.operatingSystem) { + exist = true; + break; } } + if (exist === true) { + const empty = { + deviceType: '', + manufacturer: '', + model: '', + operatingSystem: '', + }; + this.setState({ + newDevice: empty, + isEdit: false, + indexNo: null, + isSubmit: false, + }); + clearDeviceState(); + setImmediate(() => { + toastr.error('Looks like you\'ve already entered this device.'); + }); + return; + } this.showConsent(this.onAddDevice.bind(this)); } diff --git a/src/shared/reducers/page/ui/settings.js b/src/shared/reducers/page/ui/settings.js index 16d69c61f0..b0440eaed7 100644 --- a/src/shared/reducers/page/ui/settings.js +++ b/src/shared/reducers/page/ui/settings.js @@ -25,7 +25,7 @@ const TABS = { }, ACCOUNT: { MYACCOUNT: 'my account', - LINKEDACCOUNT: 'linked accounts', + // LINKEDACCOUNT: 'linked accounts', }, };