Responding to pull request review feedback

- messages.getQuoteObjectUrl: early return
- backup.js: explaining variables for long if statement
- types/messages.js: Log if thumbnail has neither data nor path
- sendmessage.js:
  - remove extraneous logging
  - fix indentation
  - upload attachments and thumbnails in parallel
- preload: don't load fs for tests, just fse
- _conversation.scss: split two selectors into two lines, 0px -> 0
- backup_test.js: use fse.existsSync and comment twoSlashes regex
- network_tests_view_test.js: Comment duplicate assignment to window.getSocketStatus
This commit is contained in:
Scott Nonnenberg 2018-04-23 15:36:47 -07:00
parent 6ec6bf08c8
commit c02860af5c
No known key found for this signature in database
GPG key ID: 5F82280C35134661
8 changed files with 34 additions and 18 deletions

View file

@ -231,7 +231,6 @@ describe('Backup', () => {
it('exports then imports to produce the same data we started with', async () => {
const {
attachmentsPath,
fs,
fse,
glob,
path,
@ -266,14 +265,16 @@ describe('Backup', () => {
return _.omit(model, ['id']);
}
// We want to know which paths have two slashes, since that tells us which files
// in the attachment fan-out are files vs. directories.
const TWO_SLASHES = /[^/]*\/[^/]*\/[^/]*/;
// On windows, attachmentsPath has a normal windows path format (\ separators), but
// glob returns only /. We normalize to / separators for our manipulations.
const twoSlashes = /[^/]*\/[^/]*\/[^/]*/;
const normalizedBase = attachmentsPath.replace(/\\/g, '/');
function removeDirs(dirs) {
return _.filter(dirs, (fullDir) => {
const dir = fullDir.replace(normalizedBase, '');
return twoSlashes.test(dir);
return TWO_SLASHES.test(dir);
});
}
@ -433,7 +434,7 @@ describe('Backup', () => {
console.log('Backup test: Ensure that messages.zip exists');
const zipPath = path.join(backupDir, 'messages.zip');
const messageZipExists = fs.existsSync(zipPath);
const messageZipExists = fse.existsSync(zipPath);
assert.strictEqual(true, messageZipExists);
console.log('Backup test: Ensure that all attachments made it to backup dir');