Skip to content

Commit

Permalink
Merge branch 'main' into arrow-feature-signed
Browse files Browse the repository at this point in the history
  • Loading branch information
JediWattson committed Jan 18, 2023
2 parents 5684e41 + e62a79f commit 9efe361
Show file tree
Hide file tree
Showing 41 changed files with 877 additions and 258 deletions.
45 changes: 38 additions & 7 deletions .github/actions/javascript/createOrUpdateStagingDeploy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ module.exports = run;

const _ = __nccwpck_require__(3571);
const {spawn} = __nccwpck_require__(3129);
const sanitizeStringForJSONParse = __nccwpck_require__(9338);

/**
* Get merge logs between two refs (inclusive) as a JavaScript object.
Expand Down Expand Up @@ -229,14 +230,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
spawnedProcess.on('error', err => reject(err));
})
.then((stdout) => {
// Remove any double-quotes from commit subjects
let sanitizedOutput = stdout.replace(/(?<="subject": ").*(?="})/g, subject => subject.replace(/"/g, "'"));
// Sanitize just the text within commit subjects as that's the only potentially un-parseable text.
const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, subject => sanitizeStringForJSONParse(subject));

// Also remove any newlines and escape backslashes
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, '\\\\');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
// Then remove newlines, format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace(/(\r\n|\n|\r)/gm, '').replace('},]', '}]');

return JSON.parse(json);
});
Expand Down Expand Up @@ -861,6 +859,39 @@ module.exports.ISSUE_OR_PULL_REQUEST_REGEX = ISSUE_OR_PULL_REQUEST_REGEX;
module.exports.POLL_RATE = POLL_RATE;


/***/ }),

/***/ 9338:
/***/ ((module) => {

const replacer = str => ({
'\\': '\\\\',
'\t': '\\t',
'\n': '\\n',
'\r': '\\r',
'\f': '\\f',
'"': '\\"',
}[str]);

/**
* Replace any characters in the string that will break JSON.parse for our Git Log output
*
* Solution partly taken from SO user Gabriel Rodríguez Flores 🙇
* https://stackoverflow.com/questions/52789718/how-to-remove-special-characters-before-json-parse-while-file-reading
*
* @param {String} inputString
* @returns {String}
*/
module.exports = function (inputString) {
if (typeof inputString !== 'string') {
throw new TypeError('Input must me of type String');
}

// Replace any newlines and escape backslashes
return inputString.replace(/\\|\t|\n|\r|\f|"/g, replacer);
};


/***/ }),

/***/ 7351:
Expand Down
45 changes: 38 additions & 7 deletions .github/actions/javascript/getDeployPullRequestList/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ module.exports = {

const _ = __nccwpck_require__(3571);
const {spawn} = __nccwpck_require__(3129);
const sanitizeStringForJSONParse = __nccwpck_require__(9338);

/**
* Get merge logs between two refs (inclusive) as a JavaScript object.
Expand Down Expand Up @@ -162,14 +163,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
spawnedProcess.on('error', err => reject(err));
})
.then((stdout) => {
// Remove any double-quotes from commit subjects
let sanitizedOutput = stdout.replace(/(?<="subject": ").*(?="})/g, subject => subject.replace(/"/g, "'"));
// Sanitize just the text within commit subjects as that's the only potentially un-parseable text.
const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, subject => sanitizeStringForJSONParse(subject));

// Also remove any newlines and escape backslashes
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, '\\\\');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
// Then remove newlines, format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace(/(\r\n|\n|\r)/gm, '').replace('},]', '}]');

return JSON.parse(json);
});
Expand Down Expand Up @@ -794,6 +792,39 @@ module.exports.ISSUE_OR_PULL_REQUEST_REGEX = ISSUE_OR_PULL_REQUEST_REGEX;
module.exports.POLL_RATE = POLL_RATE;


/***/ }),

/***/ 9338:
/***/ ((module) => {

const replacer = str => ({
'\\': '\\\\',
'\t': '\\t',
'\n': '\\n',
'\r': '\\r',
'\f': '\\f',
'"': '\\"',
}[str]);

/**
* Replace any characters in the string that will break JSON.parse for our Git Log output
*
* Solution partly taken from SO user Gabriel Rodríguez Flores 🙇
* https://stackoverflow.com/questions/52789718/how-to-remove-special-characters-before-json-parse-while-file-reading
*
* @param {String} inputString
* @returns {String}
*/
module.exports = function (inputString) {
if (typeof inputString !== 'string') {
throw new TypeError('Input must me of type String');
}

// Replace any newlines and escape backslashes
return inputString.replace(/\\|\t|\n|\r|\f|"/g, replacer);
};


/***/ }),

/***/ 7351:
Expand Down
12 changes: 5 additions & 7 deletions .github/libs/GitUtils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const _ = require('underscore');
const {spawn} = require('child_process');
const sanitizeStringForJSONParse = require('./sanitizeStringForJSONParse');

/**
* Get merge logs between two refs (inclusive) as a JavaScript object.
Expand Down Expand Up @@ -35,14 +36,11 @@ function getMergeLogsAsJSON(fromRef, toRef) {
spawnedProcess.on('error', err => reject(err));
})
.then((stdout) => {
// Remove any double-quotes from commit subjects
let sanitizedOutput = stdout.replace(/(?<="subject": ").*(?="})/g, subject => subject.replace(/"/g, "'"));
// Sanitize just the text within commit subjects as that's the only potentially un-parseable text.
const sanitizedOutput = stdout.replace(/(?<="subject": ").*?(?="})/g, subject => sanitizeStringForJSONParse(subject));

// Also remove any newlines and escape backslashes
sanitizedOutput = sanitizedOutput.replace(/(\r\n|\n|\r)/gm, '').replace(/\\/g, '\\\\');

// Then format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace('},]', '}]');
// Then remove newlines, format as JSON and convert to a proper JS object
const json = `[${sanitizedOutput}]`.replace(/(\r\n|\n|\r)/gm, '').replace('},]', '}]');

return JSON.parse(json);
});
Expand Down
26 changes: 26 additions & 0 deletions .github/libs/sanitizeStringForJSONParse.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const replacer = str => ({
'\\': '\\\\',
'\t': '\\t',
'\n': '\\n',
'\r': '\\r',
'\f': '\\f',
'"': '\\"',
}[str]);

/**
* Replace any characters in the string that will break JSON.parse for our Git Log output
*
* Solution partly taken from SO user Gabriel Rodríguez Flores 🙇
* https://stackoverflow.com/questions/52789718/how-to-remove-special-characters-before-json-parse-while-file-reading
*
* @param {String} inputString
* @returns {String}
*/
module.exports = function (inputString) {
if (typeof inputString !== 'string') {
throw new TypeError('Input must me of type String');
}

// Replace any newlines and escape backslashes
return inputString.replace(/\\|\t|\n|\r|\f|"/g, replacer);
};
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001025402
versionName "1.2.54-2"
versionCode 1001025500
versionName "1.2.55-0"
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
Expand Down
4 changes: 3 additions & 1 deletion contributingGuides/FORMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ Form inputs will NOT store draft values by default. This is to avoid accidentall

## Form Validation and Error handling

### Validate on Blur and Submit
### Validate on Blur, on Change and Submit

Each individual form field that requires validation will have its own validate test defined. When the form field loses focus (blur) we will run that validate test and show feedback. A blur on one field will not cause other fields to validate or show errors unless they have already been blurred.

Once a user has “touched” an input, i.e. blurred the input, we will also start validating that input on change when the user goes back to editing it.

All form fields will additionally be validated when the form is submitted. Although we are validating on blur this additional step is necessary to cover edge cases where forms are auto-filled or when a form is submitted by pressing enter (i.e. there will be only a ‘submit’ event and no ‘blur’ event to hook into).

The Form component takes care of validation internally and the only requirement is that we pass a validate callback prop. The validate callback takes in the input values as argument and should return an object with shape `{[inputID]: errorMessage}`. Here's an example for a form that has two inputs, `routingNumber` and `accountNumber`:
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.54</string>
<string>1.2.55</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -30,7 +30,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.2.54.2</string>
<string>1.2.55.0</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
4 changes: 2 additions & 2 deletions ios/NewExpensifyTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.2.54</string>
<string>1.2.55</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.2.54.2</string>
<string>1.2.55.0</string>
</dict>
</plist>
8 changes: 4 additions & 4 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ PODS:
- React-Core
- RNDateTimePicker (3.5.2):
- React-Core
- RNFastImage (8.5.11):
- RNFastImage (8.6.3):
- React-Core
- SDWebImage (~> 5.11.1)
- SDWebImageWebPCoder (~> 0.8.4)
Expand Down Expand Up @@ -730,7 +730,7 @@ DEPENDENCIES:
- "RNCClipboard (from `../node_modules/@react-native-community/clipboard`)"
- "RNCPicker (from `../node_modules/@react-native-picker/picker`)"
- "RNDateTimePicker (from `../node_modules/@react-native-community/datetimepicker`)"
- "RNFastImage (from `../node_modules/@pieter-pot/react-native-fast-image`)"
- RNFastImage (from `../node_modules/react-native-fast-image`)
- "RNFBAnalytics (from `../node_modules/@react-native-firebase/analytics`)"
- "RNFBApp (from `../node_modules/@react-native-firebase/app`)"
- "RNFBCrashlytics (from `../node_modules/@react-native-firebase/crashlytics`)"
Expand Down Expand Up @@ -902,7 +902,7 @@ EXTERNAL SOURCES:
RNDateTimePicker:
:path: "../node_modules/@react-native-community/datetimepicker"
RNFastImage:
:path: "../node_modules/@pieter-pot/react-native-fast-image"
:path: "../node_modules/react-native-fast-image"
RNFBAnalytics:
:path: "../node_modules/@react-native-firebase/analytics"
RNFBApp:
Expand Down Expand Up @@ -1019,7 +1019,7 @@ SPEC CHECKSUMS:
RNCClipboard: 41d8d918092ae8e676f18adada19104fa3e68495
RNCPicker: 0b65be85fe7954fbb2062ef079e3d1cde252d888
RNDateTimePicker: 7658208086d86d09e1627b5c34ba0cf237c60140
RNFastImage: 1f2cab428712a4baaf78d6169eaec7f622556dd7
RNFastImage: 5c9c9fed9c076e521b3f509fe79e790418a544e8
RNFBAnalytics: f76bfa164ac235b00505deb9fc1776634056898c
RNFBApp: 729c0666395b1953198dc4a1ec6deb8fbe1c302e
RNFBCrashlytics: 2061ca863e8e2fa1aae9b12477d7dfa8e88ca0f9
Expand Down
Loading

0 comments on commit 9efe361

Please sign in to comment.