Skip to content

Commit 45ea57f

Browse files
authoredNov 30, 2021
Merge branch 'develop' into thrive-spooky1-4
2 parents 3c68b2b + 3a66e07 commit 45ea57f

File tree

4 files changed

+65
-58
lines changed

4 files changed

+65
-58
lines changed
 

‎.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ workflows:
349349
filters:
350350
branches:
351351
only:
352-
- free
352+
- ca-profile-bug-bash
353353
# This is alternate dev env for parallel testing
354354
- "build-qa":
355355
context : org-global
@@ -363,7 +363,7 @@ workflows:
363363
filters:
364364
branches:
365365
only:
366-
- thrive-spooky1-4
366+
- free
367367
# This is stage env for production QA releases
368368
- "build-prod-staging":
369369
context : org-global

‎src/shared/components/Settings/Profile/BasicInfo/ImageInput/index.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export default class ImageInput extends React.Component {
2525
this.state = {
2626
newBasicInfo: {},
2727
isImageOversize: false,
28+
isImageFile: true,
2829
};
2930
}
3031

@@ -72,6 +73,13 @@ export default class ImageInput extends React.Component {
7273
if (file === undefined) {
7374
return;
7475
}
76+
const allowedTypes = ['image/png', 'image/jpg', 'image/jpeg'];
77+
if (!allowedTypes.includes(file.type)) {
78+
this.setState({
79+
isImageFile: false,
80+
});
81+
return;
82+
}
7583
if (file.size > 2 * 1024 * 1024) {
7684
// If file size is greater than 2 MB, show error message
7785
this.setState({
@@ -81,6 +89,7 @@ export default class ImageInput extends React.Component {
8189
}
8290
this.setState({
8391
isImageOversize: false,
92+
isImageFile: true,
8493
});
8594
uploadPhotoInit();
8695
loadImage.parseMetaData(file, (data) => {
@@ -126,7 +135,7 @@ export default class ImageInput extends React.Component {
126135
deletingPhoto,
127136
} = profileState;
128137

129-
const { newBasicInfo, isImageOversize } = this.state;
138+
const { newBasicInfo, isImageOversize, isImageFile } = this.state;
130139

131140
return (
132141
<div styleName="image">
@@ -157,7 +166,8 @@ export default class ImageInput extends React.Component {
157166
<input type="file" name="image" accept="image/*" onChange={this.onUploadPhoto} id="change-image-input" className="hidden" />
158167
</div>
159168
</div>
160-
{isImageOversize && <div styleName="error-message">Please select an image smaller than 2MB</div>}
169+
{!isImageFile && <div styleName="error-message">Please select jpg, jpeg or png image files only</div>}
170+
{isImageFile && isImageOversize && <div styleName="error-message">Please select an image smaller than 2MB</div>}
161171
</div>
162172
);
163173
}

‎src/shared/components/Settings/Profile/BasicInfo/index.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ export default class BasicInfo extends ConsentComponent {
4747
personalizationTrait: this.loadPersonalizationTrait(userTraits),
4848
newBasicInfo: {
4949
handle: '',
50-
firstName: '',
51-
lastName: '',
50+
firstName: null,
51+
lastName: null,
5252
gender: '',
5353
ethnicBackground: null,
5454
shortBio: '',
@@ -377,6 +377,8 @@ export default class BasicInfo extends ConsentComponent {
377377
}
378378
if (_.has(value, 'firstName')) {
379379
newBasicInfo.firstName = value.firstName;
380+
} else {
381+
newBasicInfo.firstName = '';
380382
}
381383
if (_.has(value, 'gender')) {
382384
newBasicInfo.gender = value.gender;
@@ -390,6 +392,8 @@ export default class BasicInfo extends ConsentComponent {
390392
}
391393
if (_.has(value, 'lastName')) {
392394
newBasicInfo.lastName = value.lastName;
395+
} else {
396+
newBasicInfo.lastName = '';
393397
}
394398
if (_.has(value, 'primaryInterestInTopcoder')) {
395399
newBasicInfo.primaryInterestInTopcoder = value.primaryInterestInTopcoder;
@@ -501,7 +505,7 @@ export default class BasicInfo extends ConsentComponent {
501505
<div styleName="field col-2">
502506
<span styleName="text-required">* Required</span>
503507
<input disabled={!canModifyTrait} id="firstName" name="firstName" type="text" placeholder="First Name" onChange={this.onUpdateInput} value={newBasicInfo.firstName} maxLength="64" required />
504-
<ErrorMessage invalid={_.isEmpty(newBasicInfo.firstName) && inputChanged} message="First Name cannot be empty" />
508+
<ErrorMessage invalid={_.isEmpty(newBasicInfo.firstName) && !_.isNull(newBasicInfo.firstName) && inputChanged} message="First Name cannot be empty" />
505509
</div>
506510
</div>
507511
<div styleName="row">
@@ -514,7 +518,7 @@ export default class BasicInfo extends ConsentComponent {
514518
<div styleName="field col-2">
515519
<span styleName="text-required">* Required</span>
516520
<input disabled={!canModifyTrait} id="lastName" name="lastName" type="text" placeholder="Last Name" onChange={this.onUpdateInput} value={newBasicInfo.lastName} maxLength="64" required />
517-
<ErrorMessage invalid={_.isEmpty(newBasicInfo.lastName) && inputChanged} message="Last Name cannot be empty" />
521+
<ErrorMessage invalid={_.isEmpty(newBasicInfo.lastName) && !_.isNull(newBasicInfo.lastName) && inputChanged} message="Last Name cannot be empty" />
518522
</div>
519523
</div>
520524
<div styleName="row">

‎src/shared/containers/Gigs/RecruitCRMJobDetails.jsx

Lines changed: 43 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,6 @@ ${config.URL.BASE}${config.GIGS_PAGES_PATH}/${props.id}`,
6868
// exit no email sending
6969
return;
7070
}
71-
// process sent log
72-
let { emailInvitesLog, emailInvitesStatus } = growSurf.data.metadata;
73-
if (!emailInvitesLog) emailInvitesLog = '';
74-
// check if email is in sent log alredy?
75-
const foundInLog = emailInvitesLog.indexOf(email);
76-
if (foundInLog !== -1) {
77-
this.setState({
78-
isReferrError: {
79-
message: `${email} was already invited.`,
80-
userError: true,
81-
},
82-
});
83-
// exit no email sending
84-
return;
85-
}
8671
// check if email is already referred?
8772
const growCheck = await fetch(`${PROXY_ENDPOINT}/growsurf/participant/${email}`);
8873
if (growCheck.status === 200) {
@@ -125,43 +110,51 @@ ${config.URL.BASE}${config.GIGS_PAGES_PATH}/${props.id}`,
125110
// exit no email tracking due to the error
126111
return;
127112
}
128-
// parse the log to array of emails
129-
if (emailInvitesLog.length) {
130-
emailInvitesLog = emailInvitesLog.split(',');
131-
} else emailInvitesLog = [];
132-
// prepare growSurf update payload
133-
// we keep only 10 emails in the log to justify program rules
134-
if (emailInvitesLog.length < 10) {
135-
emailInvitesLog.push(email);
136-
}
137-
// Auto change status when 10 emails sent
138-
if (emailInvitesLog.length === 10 && emailInvitesStatus !== 'Paid' && emailInvitesStatus !== 'Payment Pending') {
139-
emailInvitesStatus = 'Payment Pending';
140-
}
141-
// put the tracking update in growsurf
142-
const updateRed = await fetch(`${PROXY_ENDPOINT}/growsurf/participant/${growSurf.data.id}`, {
143-
method: 'PATCH',
144-
headers: {
145-
'Content-Type': 'application/json',
146-
Authorization: `Bearer ${tokenV3}`,
147-
},
148-
body: JSON.stringify({
149-
...growSurf.data,
150-
metadata: {
151-
...growSurf.data.metadata,
152-
emailInvitesSent: Number(growSurf.data.metadata.emailInvitesSent || 0) + 1,
153-
emailInvitesLog: emailInvitesLog.join(),
154-
emailInvitesStatus,
113+
// process sent log
114+
let { emailInvitesLog, emailInvitesStatus } = growSurf.data.metadata;
115+
if (!emailInvitesLog) emailInvitesLog = '';
116+
// check if email is in sent log alredy?
117+
const foundInLog = emailInvitesLog.indexOf(email);
118+
// only when email is new - put it in log, update counters and etc.
119+
if (foundInLog === -1) {
120+
// parse the log to array of emails
121+
if (emailInvitesLog.length) {
122+
emailInvitesLog = emailInvitesLog.split(',');
123+
} else emailInvitesLog = [];
124+
// prepare growSurf update payload
125+
// we keep only 10 emails in the log to justify program rules
126+
if (emailInvitesLog.length < 10) {
127+
emailInvitesLog.push(email);
128+
}
129+
// Auto change status when 10 emails sent
130+
if (emailInvitesLog.length === 10 && emailInvitesStatus !== 'Paid' && emailInvitesStatus !== 'Payment Pending') {
131+
emailInvitesStatus = 'Payment Pending';
132+
}
133+
// put the tracking update in growsurf
134+
const updateRed = await fetch(`${PROXY_ENDPOINT}/growsurf/participant/${growSurf.data.id}`, {
135+
method: 'PATCH',
136+
headers: {
137+
'Content-Type': 'application/json',
138+
Authorization: `Bearer ${tokenV3}`,
155139
},
156-
}),
157-
});
158-
if (updateRed.status >= 300) {
159-
this.setState({
160-
isReferrError: await updateRed.json(),
140+
body: JSON.stringify({
141+
...growSurf.data,
142+
metadata: {
143+
...growSurf.data.metadata,
144+
emailInvitesSent: Number(growSurf.data.metadata.emailInvitesSent || 0) + 1,
145+
emailInvitesLog: emailInvitesLog.join(),
146+
emailInvitesStatus,
147+
},
148+
}),
161149
});
162-
// exit no email tracking due to the error
163-
// just notify the user about it
164-
return;
150+
if (updateRed.status >= 300) {
151+
this.setState({
152+
isReferrError: await updateRed.json(),
153+
});
154+
// exit no email tracking due to the error
155+
// just notify the user about it
156+
return;
157+
}
165158
}
166159
// finally do:
167160
this.setState({

0 commit comments

Comments
 (0)
Please sign in to comment.