Skip to content

Release v1.14.3 - [Bug Bash] Fixes I (#5826) #5827

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ workflows:
filters:
branches:
only:
- free
- develop
# This is alternate dev env for parallel testing
- "build-test":
context : org-global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ exports[`renders account setting page correctly 1`] = `
<SideBar
icons={
Object {
"linked accounts": <LinkedAccountIcon
height="30"
viewBox="0 0 30 30"
width="30"
xmlns="http://www.w3.org/2000/svg"
/>,
"my account": <MyAccountIcon
height="30"
viewBox="0 0 30 30"
Expand All @@ -27,7 +21,6 @@ exports[`renders account setting page correctly 1`] = `
names={
Array [
"my account",
"linked account",
]
}
/>
Expand Down
2 changes: 1 addition & 1 deletion __tests__/shared/components/Settings/Account/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const settingsUI = {
TABS: {
ACCOUNT: {
MYACCOUNT: 'my account',
LINKEDACCOUNT: 'linked account',
// LINKEDACCOUNT: 'linked account',
},
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default class AddWebLink extends React.Component {
super(props);
this.state = {
webLink: '',
webLinkEmpty: false,
};

this.onUpdateWebLink = this.onUpdateWebLink.bind(this);
Expand All @@ -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 });
}

Expand Down Expand Up @@ -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);
}
Expand All @@ -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();
Expand Down Expand Up @@ -172,6 +183,15 @@ export default class AddWebLink extends React.Component {
onKeyDown={this.onAddWebLink}
required
/>
{
webLinkEmpty && (
<div styleName="form-input-error">
<p>
Please Enter External Link
</p>
</div>
)
}
{
!webLinkValid && !webLinkExist
&& (
Expand Down
12 changes: 7 additions & 5 deletions src/shared/components/Settings/Account/LinkedAccount/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions src/shared/components/Settings/Account/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -74,14 +74,14 @@ export default class Account extends React.Component {
const currentTab = this.tablink || settingsUI.currentAccountTab;
const icons = {
'my account': <MyAccountIcon />,
'linked accounts': <LinkedAccountIcon />,
// 'linked accounts': <LinkedAccountIcon />,
};
const renderTabContent = (tab) => {
switch (tab) {
case 'my account':
return <MyAccount {...this.props} />;
case 'linked accounts':
return <LinkedAccount {...this.props} />;
// case 'linked accounts':
// return <LinkedAccount {...this.props} />;
default:
return <ComingSoon />;
}
Expand Down
4 changes: 4 additions & 0 deletions src/shared/components/Settings/Profile/BasicInfo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
13 changes: 7 additions & 6 deletions src/shared/components/Settings/Profile/Education/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

/**
Expand Down Expand Up @@ -530,6 +528,7 @@ export default class Education extends ConsentComponent {
<div styleName="field col-2">
<DatePicker
readOnly
showClearDate
numberOfMonths={1}
isOutsideRange={moment().subtract(1, 'd')}
date={newEducation.timePeriodFrom}
Expand Down Expand Up @@ -559,6 +558,7 @@ export default class Education extends ConsentComponent {
newEducation.graduated ? (
<DatePicker
readOnly
showClearDate
numberOfMonths={1}
isOutsideRange={moment().subtract(1, 'd')}
date={newEducation.timePeriodTo}
Expand All @@ -569,6 +569,7 @@ export default class Education extends ConsentComponent {
) : (
<DatePicker
readOnly
showClearDate
numberOfMonths={1}
date={newEducation.timePeriodTo}
id="date-to1"
Expand Down
14 changes: 14 additions & 0 deletions src/shared/components/Settings/Profile/Education/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ $checkbox-bg-selected: $tc-dark-blue;
flex-direction: column;
align-items: left;

:global {
.SingleDatePickerInput {
&__showClearDate {
padding-right: 0;
}

&_clearDate {
padding: 8px 10px;
top: 20px;
background: transparent;
}
}
}

@include upto-sm {
padding-bottom: 0;
}
Expand Down
1 change: 1 addition & 0 deletions src/shared/components/Settings/Profile/Hobby/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export default class Hobby extends ConsentComponent {
}
this.setState({
showConfirmation: false,
isEdit: false,
indexNo: null,
isSubmit: false,
});
Expand Down
9 changes: 0 additions & 9 deletions src/shared/components/Settings/Profile/Work/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,6 @@ export default class Work extends ConsentComponent {
endDateInvalid: false,
endDateDisabled: false,
endDateInvalidMsg: '',
newWork: {
company: '',
position: '',
cityTown: '',
timePeriodFrom: '',
timePeriodTo: '',
industry: '',
working: false,
},
});
}

Expand Down
64 changes: 31 additions & 33 deletions src/shared/components/Settings/Tools/Devices/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,46 +84,44 @@ export default class Devices extends ConsentComponent {
*/
onHandleAddDevice(e) {
e.preventDefault();
const { newDevice, deviceTrait, isEdit } = this.state;
const { newDevice, deviceTrait } = this.state;
const { clearDeviceState } = this.props;
this.setState({ isSubmit: true });
if (this.onCheckFormValue(newDevice)) {
return;
}
if (!isEdit) {
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;
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));
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/reducers/page/ui/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const TABS = {
},
ACCOUNT: {
MYACCOUNT: 'my account',
LINKEDACCOUNT: 'linked accounts',
// LINKEDACCOUNT: 'linked accounts',
},
};

Expand Down