diff --git a/.eslintrc.js b/.eslintrc.js index 75ae1ccfe..7dcd2f1e6 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -37,14 +37,6 @@ const rules = { { overrides: { '?': 'ignore', ':': 'ignore' } }, ], - // Temporarily turned off during transition from TSLint - // JIRA: DESKTOP-623 - 'import/order': 'off', - 'no-else-return': 'off', - 'no-async-promise-executor': 'off', - 'prefer-object-spread': 'off', - strict: 'off', - quotes: [ 'error', 'single', diff --git a/Gruntfile.js b/Gruntfile.js index 9e5e2ccb5..62461d862 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,5 +1,4 @@ const { join } = require('path'); -const packageJson = require('./package.json'); const importOnce = require('node-sass-import-once'); const rimraf = require('rimraf'); const mkdirp = require('mkdirp'); @@ -8,6 +7,7 @@ const asar = require('asar'); const fs = require('fs'); const assert = require('assert'); const sass = require('node-sass'); +const packageJson = require('./package.json'); /* eslint-disable more/no-then, no-console */ diff --git a/app/attachment_channel.js b/app/attachment_channel.js index 2c921b1b3..d7c3fb294 100644 --- a/app/attachment_channel.js +++ b/app/attachment_channel.js @@ -1,6 +1,6 @@ const electron = require('electron'); -const Attachments = require('./attachments'); const rimraf = require('rimraf'); +const Attachments = require('./attachments'); const { ipcMain } = electron; diff --git a/app/attachments.js b/app/attachments.js index c5a6f73bb..b5713fa1c 100644 --- a/app/attachments.js +++ b/app/attachments.js @@ -10,8 +10,8 @@ const toArrayBuffer = require('to-arraybuffer'); const { map, isArrayBuffer, isString } = require('lodash'); const normalizePath = require('normalize-path'); const sanitizeFilename = require('sanitize-filename'); -const { isPathInside } = require('../ts/util/isPathInside'); const getGuid = require('uuid/v4'); +const { isPathInside } = require('../ts/util/isPathInside'); let xattr; try { diff --git a/js/about_start.js b/js/about_start.js index bab1b8bf2..97133daf4 100644 --- a/js/about_start.js +++ b/js/about_start.js @@ -17,8 +17,6 @@ $('.environment').text(states.join(' - ')); // Install the 'dismiss with escape key' handler $(document).on('keydown', e => { - 'use strict'; - if (e.keyCode === 27) { window.closeAbout(); } diff --git a/js/background.js b/js/background.js index f1605c9dc..6fe608ec1 100644 --- a/js/background.js +++ b/js/background.js @@ -14,8 +14,6 @@ // eslint-disable-next-line func-names (async function() { - 'use strict'; - const eventHandlerQueue = new window.PQueue({ concurrency: 1 }); Whisper.deliveryReceiptQueue = new window.PQueue({ concurrency: 1, @@ -817,7 +815,8 @@ const target = toSearch[i]; if (!unreadOnly) { return target.id; - } else if (target.unreadCount > 0) { + } + if (target.unreadCount > 0) { return target.id; } } diff --git a/js/chromium.js b/js/chromium.js index 4e1567be4..a44c52ed2 100644 --- a/js/chromium.js +++ b/js/chromium.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - // Browser specific functions for Chrom* window.extension = window.extension || {}; diff --git a/js/database.js b/js/database.js index c78db08c9..1ca0d5fa3 100644 --- a/js/database.js +++ b/js/database.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; window.Whisper.Database = window.Whisper.Database || {}; window.Whisper.Database.id = window.Whisper.Database.id || 'signal'; diff --git a/js/debug_log_start.js b/js/debug_log_start.js index 35aea107e..080682d92 100644 --- a/js/debug_log_start.js +++ b/js/debug_log_start.js @@ -2,8 +2,6 @@ /* global Whisper: false */ $(document).on('keydown', e => { - 'use strict'; - if (e.keyCode === 27) { window.closeDebugLog(); } diff --git a/js/deletes.js b/js/deletes.js index 4ae40c3c8..36446c06b 100644 --- a/js/deletes.js +++ b/js/deletes.js @@ -9,8 +9,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.Deletes = new (Backbone.Collection.extend({ forMessage(message) { diff --git a/js/delivery_receipts.js b/js/delivery_receipts.js index 8b19e41c8..e38281eaf 100644 --- a/js/delivery_receipts.js +++ b/js/delivery_receipts.js @@ -10,8 +10,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.DeliveryReceipts = new (Backbone.Collection.extend({ diff --git a/js/expiring_messages.js b/js/expiring_messages.js index 4b80d4326..4c490921d 100644 --- a/js/expiring_messages.js +++ b/js/expiring_messages.js @@ -9,8 +9,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; async function destroyExpiredMessages() { diff --git a/js/expiring_tap_to_view_messages.js b/js/expiring_tap_to_view_messages.js index 52e4ee46e..72fc68656 100644 --- a/js/expiring_tap_to_view_messages.js +++ b/js/expiring_tap_to_view_messages.js @@ -6,8 +6,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; async function eraseTapToViewMessages() { diff --git a/js/keychange_listener.js b/js/keychange_listener.js index f913618ed..5edc928ed 100644 --- a/js/keychange_listener.js +++ b/js/keychange_listener.js @@ -4,8 +4,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.KeyChangeListener = { diff --git a/js/loading_start.js b/js/loading_start.js index a27121045..1fb09869f 100644 --- a/js/loading_start.js +++ b/js/loading_start.js @@ -1,7 +1,5 @@ /* global $ */ $(() => { - 'use strict'; - $('.message').text(window.i18n('optimizingApplication')); }); diff --git a/js/logging.js b/js/logging.js index 89dedf776..0542fa856 100644 --- a/js/logging.js +++ b/js/logging.js @@ -1,6 +1,5 @@ /* eslint-env node */ -/* eslint strict: ['error', 'never'] */ /* eslint-disable no-console */ const electron = require('electron'); diff --git a/js/message_controller.js b/js/message_controller.js index f6dfd6155..dc903ba90 100644 --- a/js/message_controller.js +++ b/js/message_controller.js @@ -1,7 +1,5 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; const messageLookup = Object.create(null); diff --git a/js/message_requests.js b/js/message_requests.js index 7816c83a1..c7973ca51 100644 --- a/js/message_requests.js +++ b/js/message_requests.js @@ -8,8 +8,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.MessageRequests = new (Backbone.Collection.extend({ forConversation(conversation) { diff --git a/js/models/blockedNumbers.js b/js/models/blockedNumbers.js index 081f705f6..03bbc55c5 100644 --- a/js/models/blockedNumbers.js +++ b/js/models/blockedNumbers.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - const BLOCKED_NUMBERS_ID = 'blocked'; const BLOCKED_UUIDS_ID = 'blocked-uuids'; const BLOCKED_GROUPS_ID = 'blocked-groups'; diff --git a/js/models/conversations.js b/js/models/conversations.js index b47daf55e..c8fb66905 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -16,8 +16,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; const SEALED_SENDER = { @@ -852,7 +850,7 @@ { syncMessage: true } ); const contactSendOptions = this.getSendOptions(); - const options = Object.assign({}, sendOptions, contactSendOptions); + const options = { ...sendOptions, ...contactSendOptions }; const promise = textsecure.storage.protocol.loadIdentityKey(e164); return promise.then(key => diff --git a/js/models/messages.js b/js/models/messages.js index 8a803129f..bda36f368 100644 --- a/js/models/messages.js +++ b/js/models/messages.js @@ -16,8 +16,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; const { @@ -157,42 +155,50 @@ type: 'unsupportedMessage', data: this.getPropsForUnsupportedMessage(), }; - } else if (this.isMessageHistoryUnsynced()) { + } + if (this.isMessageHistoryUnsynced()) { return { type: 'linkNotification', data: null, }; - } else if (this.isExpirationTimerUpdate()) { + } + if (this.isExpirationTimerUpdate()) { return { type: 'timerNotification', data: this.getPropsForTimerNotification(), }; - } else if (this.isKeyChange()) { + } + if (this.isKeyChange()) { return { type: 'safetyNumberNotification', data: this.getPropsForSafetyNumberNotification(), }; - } else if (this.isVerifiedChange()) { + } + if (this.isVerifiedChange()) { return { type: 'verificationNotification', data: this.getPropsForVerificationNotification(), }; - } else if (this.isGroupUpdate()) { + } + if (this.isGroupUpdate()) { return { type: 'groupNotification', data: this.getPropsForGroupNotification(), }; - } else if (this.isEndSession()) { + } + if (this.isEndSession()) { return { type: 'resetSessionNotification', data: this.getPropsForResetSessionNotification(), }; - } else if (this.isCallHistory()) { + } + if (this.isCallHistory()) { return { type: 'callHistory', data: this.getPropsForCallHistory(), }; - } else if (this.isProfileChange()) { + } + if (this.isProfileChange()) { return { type: 'profileChange', data: this.getPropsForProfileChange(), @@ -421,7 +427,8 @@ ...basicProps, type: 'fromSync', }; - } else if (sourceId && sourceId === ourId) { + } + if (sourceId && sourceId === ourId) { return { ...basicProps, type: 'fromMe', @@ -875,14 +882,13 @@ const thumbnailWithObjectUrl = !path && !objectUrl ? null - : Object.assign({}, attachment.thumbnail || {}, { - objectUrl: path || objectUrl, - }); + : { ...(attachment.thumbnail || {}), objectUrl: path || objectUrl }; - return Object.assign({}, attachment, { + return { + ...attachment, isVoiceMessage: Signal.Types.Attachment.isVoiceMessage(attachment), thumbnail: thumbnailWithObjectUrl, - }); + }; }, getNotificationData() /* : { text: string, emoji?: string } */ { @@ -916,7 +922,8 @@ text: i18n('message--getDescription--disappearing-photo'), emoji: 'πŸ“·', }; - } else if (Attachment.isVideo(attachments)) { + } + if (Attachment.isVideo(attachments)) { return { text: i18n('message--getDescription--disappearing-video'), emoji: 'πŸŽ₯', @@ -934,7 +941,8 @@ if (groupUpdate.left === 'You') { return { text: i18n('youLeftTheGroup') }; - } else if (groupUpdate.left) { + } + if (groupUpdate.left) { return { text: i18n('leftTheGroup', [ this.getNameForNumber(groupUpdate.left), @@ -1015,22 +1023,26 @@ text: body || i18n('message--getNotificationText--gif'), emoji: '🎑', }; - } else if (Attachment.isImage(attachments)) { + } + if (Attachment.isImage(attachments)) { return { text: body || i18n('message--getNotificationText--photo'), emoji: 'πŸ“·', }; - } else if (Attachment.isVideo(attachments)) { + } + if (Attachment.isVideo(attachments)) { return { text: body || i18n('message--getNotificationText--video'), emoji: 'πŸŽ₯', }; - } else if (Attachment.isVoiceMessage(attachment)) { + } + if (Attachment.isVoiceMessage(attachment)) { return { text: body || i18n('message--getNotificationText--voice-message'), emoji: '🎀', }; - } else if (Attachment.isAudio(attachments)) { + } + if (Attachment.isAudio(attachments)) { return { text: body || i18n('message--getNotificationText--audio-message'), emoji: 'πŸ”ˆ', @@ -2361,14 +2373,16 @@ confirm(); return; - } else if (isUpdate) { + } + if (isUpdate) { window.log.warn( `handleDataMessage: Received update transcript, but no existing entry for message ${message.idForLogging()}. Dropping.` ); confirm(); return; - } else if (existingMessage) { + } + if (existingMessage) { window.log.warn( `handleDataMessage: Received duplicate transcript for message ${message.idForLogging()}, but it was not an update transcript. Dropping.` ); diff --git a/js/modules/auto_orient_image.js b/js/modules/auto_orient_image.js index fbdabfd64..ced7d3bf8 100644 --- a/js/modules/auto_orient_image.js +++ b/js/modules/auto_orient_image.js @@ -7,17 +7,13 @@ const DEFAULT_JPEG_QUALITY = 0.85; // Documentation for `options` (`LoadImageOptions`): // https://github.com/blueimp/JavaScript-Load-Image/tree/v2.18.0#options exports.autoOrientImage = (fileOrBlobOrURL, options = {}) => { - const optionsWithDefaults = Object.assign( - { - type: 'image/jpeg', - quality: DEFAULT_JPEG_QUALITY, - }, - options, - { - canvas: true, - orientation: true, - } - ); + const optionsWithDefaults = { + type: 'image/jpeg', + quality: DEFAULT_JPEG_QUALITY, + ...options, + canvas: true, + orientation: true, + }; return new Promise((resolve, reject) => { loadImage( diff --git a/js/modules/backup.js b/js/modules/backup.js index 2fb600eb8..3230439e0 100644 --- a/js/modules/backup.js +++ b/js/modules/backup.js @@ -459,12 +459,7 @@ async function writeQuoteThumbnails(quotedAttachments, options) { try { await Promise.all( _.map(quotedAttachments, (attachment, index) => - writeQuoteThumbnail( - attachment, - Object.assign({}, options, { - index, - }) - ) + writeQuoteThumbnail(attachment, { ...options, index }) ) ); } catch (error) { @@ -531,12 +526,7 @@ async function writeAttachments(attachments, options) { const { name } = options; const promises = _.map(attachments, (attachment, index) => - writeAttachment( - attachment, - Object.assign({}, options, { - index, - }) - ) + writeAttachment(attachment, { ...options, index }) ); try { await Promise.all(promises); @@ -575,14 +565,7 @@ async function writeContactAvatars(contact, options) { try { await Promise.all( - _.map(contact, (item, index) => - writeAvatar( - item, - Object.assign({}, options, { - index, - }) - ) - ) + _.map(contact, (item, index) => writeAvatar(item, { ...options, index })) ); } catch (error) { window.log.error( @@ -620,12 +603,7 @@ async function writePreviews(preview, options) { try { await Promise.all( _.map(preview, (item, index) => - writePreviewImage( - item, - Object.assign({}, options, { - index, - }) - ) + writePreviewImage(item, { ...options, index }) ) ); } catch (error) { @@ -1236,12 +1214,11 @@ async function exportToDirectory(directory, options) { const attachmentsDir = await createDirectory(directory, 'attachments'); await exportConversationListToFile(stagingDir); - await exportConversations( - Object.assign({}, options, { - messagesDir: stagingDir, - attachmentsDir, - }) - ); + await exportConversations({ + ...options, + messagesDir: stagingDir, + attachmentsDir, + }); const archivePath = path.join(directory, ARCHIVE_NAME); await compressArchive(archivePath, stagingDir); @@ -1281,10 +1258,7 @@ async function importFromDirectory(directory, options) { loadConversationLookup(), ]); const [messageLookup, conversationLookup] = lookups; - options = Object.assign({}, options, { - messageLookup, - conversationLookup, - }); + options = { ...options, messageLookup, conversationLookup }; const archivePath = path.join(directory, ARCHIVE_NAME); if (fs.existsSync(archivePath)) { @@ -1312,11 +1286,9 @@ async function importFromDirectory(directory, options) { await decryptFile(archivePath, decryptedArchivePath, options); await decompressArchive(decryptedArchivePath, stagingDir); - options = Object.assign({}, options, { - attachmentsDir, - }); + options = { ...options, attachmentsDir }; const result = await importNonMessages(stagingDir, options); - await importConversations(stagingDir, Object.assign({}, options)); + await importConversations(stagingDir, { ...options }); window.log.info('Done importing from backup!'); return result; diff --git a/js/modules/debug.js b/js/modules/debug.js index 6f16ada8b..f787fb966 100644 --- a/js/modules/debug.js +++ b/js/modules/debug.js @@ -111,20 +111,22 @@ const createRandomMessage = async ({ conversationId } = {}) => { const _createMessage = ({ commonProperties, conversationId, type } = {}) => { switch (type) { case 'incoming': - return Object.assign({}, commonProperties, { + return { + ...commonProperties, flags: 0, source: conversationId, sourceDevice: 1, - }); + }; case 'outgoing': - return Object.assign({}, commonProperties, { + return { + ...commonProperties, delivered: 1, delivered_to: [conversationId], expireTimer: 0, recipients: [conversationId], sent_to: [conversationId], synced: true, - }); + }; default: throw new TypeError(`Unknown message type: '${type}'`); } diff --git a/js/modules/i18n.js b/js/modules/i18n.js index 6aa0863d4..507b13d7e 100644 --- a/js/modules/i18n.js +++ b/js/modules/i18n.js @@ -34,7 +34,8 @@ exports.setup = (locale, messages) => { const { message } = entry; if (!substitutions) { return message; - } else if (Array.isArray(substitutions)) { + } + if (Array.isArray(substitutions)) { return substitutions.reduce( (result, substitution) => result.replace(/\$.+?\$/, substitution), message diff --git a/js/modules/link_previews.js b/js/modules/link_previews.js index f4232128b..2b7b8c3f9 100644 --- a/js/modules/link_previews.js +++ b/js/modules/link_previews.js @@ -175,15 +175,20 @@ const KB = 1024; function getChunkPattern(size, initialOffset) { if (size > MB) { return _getRequestPattern(size, MB, initialOffset); - } else if (size > 500 * KB) { + } + if (size > 500 * KB) { return _getRequestPattern(size, 500 * KB, initialOffset); - } else if (size > 100 * KB) { + } + if (size > 100 * KB) { return _getRequestPattern(size, 100 * KB, initialOffset); - } else if (size > 50 * KB) { + } + if (size > 50 * KB) { return _getRequestPattern(size, 50 * KB, initialOffset); - } else if (size > 10 * KB) { + } + if (size > 10 * KB) { return _getRequestPattern(size, 10 * KB, initialOffset); - } else if (size > KB) { + } + if (size > KB) { return _getRequestPattern(size, KB, initialOffset); } diff --git a/js/modules/types/attachment.js b/js/modules/types/attachment.js index 1235582b5..6e494a83c 100644 --- a/js/modules/types/attachment.js +++ b/js/modules/types/attachment.js @@ -1,14 +1,14 @@ const is = require('@sindresorhus/is'); -const AttachmentTS = require('../../../ts/types/Attachment'); -const GoogleChrome = require('../../../ts/util/GoogleChrome'); -const MIME = require('../../../ts/types/MIME'); -const { toLogFormat } = require('./errors'); const { arrayBufferToBlob, blobToArrayBuffer, dataURLToBlob, } = require('blob-util'); +const AttachmentTS = require('../../../ts/types/Attachment'); +const GoogleChrome = require('../../../ts/util/GoogleChrome'); +const MIME = require('../../../ts/types/MIME'); +const { toLogFormat } = require('./errors'); const { autoOrientImage } = require('../auto_orient_image'); const { migrateDataToFileSystem, @@ -73,10 +73,11 @@ exports.autoOrientJPEG = async attachment => { // retain it but due to reports of data loss, we don’t want to overburden IndexedDB // by potentially doubling stored image data. // See: https://github.com/signalapp/Signal-Desktop/issues/1589 - const newAttachment = Object.assign({}, attachment, { + const newAttachment = { + ...attachment, data: newDataArrayBuffer, size: newDataArrayBuffer.byteLength, - }); + }; // `digest` is no longer valid for auto-oriented image data, so we discard it: delete newAttachment.digest; @@ -103,9 +104,7 @@ exports._replaceUnicodeOrderOverridesSync = attachment => { INVALID_CHARACTERS_PATTERN, UNICODE_REPLACEMENT_CHARACTER ); - const newAttachment = Object.assign({}, attachment, { - fileName: normalizedFilename, - }); + const newAttachment = { ...attachment, fileName: normalizedFilename }; return newAttachment; }; @@ -145,7 +144,7 @@ exports.removeSchemaVersion = ({ attachment, logger }) => { return attachment; } - const attachmentWithoutSchemaVersion = Object.assign({}, attachment); + const attachmentWithoutSchemaVersion = { ...attachment }; delete attachmentWithoutSchemaVersion.schemaVersion; return attachmentWithoutSchemaVersion; }; @@ -179,7 +178,7 @@ exports.loadData = readAttachmentData => { } const data = await readAttachmentData(attachment.path); - return Object.assign({}, attachment, { data, size: data.byteLength }); + return { ...attachment, data, size: data.byteLength }; }; }; diff --git a/js/modules/types/attachment/migrate_data_to_file_system.js b/js/modules/types/attachment/migrate_data_to_file_system.js index dded244ad..a2f431db9 100644 --- a/js/modules/types/attachment/migrate_data_to_file_system.js +++ b/js/modules/types/attachment/migrate_data_to_file_system.js @@ -32,8 +32,6 @@ exports.migrateDataToFileSystem = async ( const path = await writeNewAttachmentData(data); - const attachmentWithoutData = omit(Object.assign({}, attachment, { path }), [ - 'data', - ]); + const attachmentWithoutData = omit({ ...attachment, path }, ['data']); return attachmentWithoutData; }; diff --git a/js/modules/types/contact.js b/js/modules/types/contact.js index 56baa425d..7d656b8cb 100644 --- a/js/modules/types/contact.js +++ b/js/modules/types/contact.js @@ -17,15 +17,17 @@ exports.parseAndWriteAvatar = upgradeAttachment => async ( const { avatar } = contact; // This is to ensure that an omit() call doesn't pull in prototype props/methods - const contactShallowCopy = Object.assign({}, contact); + const contactShallowCopy = { ...contact }; const contactWithUpdatedAvatar = avatar && avatar.avatar - ? Object.assign({}, contactShallowCopy, { - avatar: Object.assign({}, avatar, { + ? { + ...contactShallowCopy, + avatar: { + ...avatar, avatar: await upgradeAttachment(avatar.avatar, context), - }), - }) + }, + } : omit(contactShallowCopy, ['avatar']); // eliminates empty numbers, emails, and addresses; adds type if not provided @@ -50,14 +52,13 @@ function parseContact(contact, options = {}) { const boundParsePhone = phoneNumber => parsePhoneItem(phoneNumber, { regionCode }); - return Object.assign( - {}, - omit(contact, ['avatar', 'number', 'email', 'address']), - parseAvatar(contact.avatar), - createArrayKey('number', compact(map(contact.number, boundParsePhone))), - createArrayKey('email', compact(map(contact.email, parseEmailItem))), - createArrayKey('address', compact(map(contact.address, parseAddress))) - ); + return { + ...omit(contact, ['avatar', 'number', 'email', 'address']), + ...parseAvatar(contact.avatar), + ...createArrayKey('number', compact(map(contact.number, boundParsePhone))), + ...createArrayKey('email', compact(map(contact.email, parseEmailItem))), + ...createArrayKey('address', compact(map(contact.address, parseAddress))), + }; } function idForLogging(message) { @@ -94,10 +95,11 @@ function parsePhoneItem(item, options = {}) { return null; } - return Object.assign({}, item, { + return { + ...item, type: item.type || DEFAULT_PHONE_TYPE, value: parsePhoneNumber(item.value, { regionCode }), - }); + }; } function parseEmailItem(item) { @@ -105,9 +107,7 @@ function parseEmailItem(item) { return null; } - return Object.assign({}, item, { - type: item.type || DEFAULT_EMAIL_TYPE, - }); + return { ...item, type: item.type || DEFAULT_EMAIL_TYPE }; } function parseAddress(address) { @@ -127,9 +127,7 @@ function parseAddress(address) { return null; } - return Object.assign({}, address, { - type: address.type || DEFAULT_ADDRESS_TYPE, - }); + return { ...address, type: address.type || DEFAULT_ADDRESS_TYPE }; } function parseAvatar(avatar) { @@ -138,9 +136,7 @@ function parseAvatar(avatar) { } return { - avatar: Object.assign({}, avatar, { - isProfile: avatar.isProfile || false, - }), + avatar: { ...avatar, isProfile: avatar.isProfile || false }, }; } diff --git a/js/modules/types/message.js b/js/modules/types/message.js index 202080d58..312e74ff1 100644 --- a/js/modules/types/message.js +++ b/js/modules/types/message.js @@ -72,9 +72,7 @@ exports.initializeSchemaVersion = ({ message, logger }) => { : 0; const hasAttachments = numAttachments > 0; if (!hasAttachments) { - return Object.assign({}, message, { - schemaVersion: INITIAL_SCHEMA_VERSION, - }); + return { ...message, schemaVersion: INITIAL_SCHEMA_VERSION }; } // All attachments should have the same schema version, so we just pick @@ -85,12 +83,13 @@ exports.initializeSchemaVersion = ({ message, logger }) => { ) ? firstAttachment.schemaVersion : INITIAL_SCHEMA_VERSION; - const messageWithInitialSchema = Object.assign({}, message, { + const messageWithInitialSchema = { + ...message, schemaVersion: inheritedSchemaVersion, attachments: message.attachments.map(attachment => Attachment.removeSchemaVersion({ attachment, logger }) ), - }); + }; return messageWithInitialSchema; }; @@ -158,7 +157,7 @@ exports._withSchemaVersion = ({ schemaVersion, upgrade }) => { return message; } - return Object.assign({}, upgradedMessage, { schemaVersion }); + return { ...upgradedMessage, schemaVersion }; }; }; @@ -172,7 +171,7 @@ exports._mapAttachments = upgradeAttachment => async (message, context) => { const attachments = await Promise.all( (message.attachments || []).map(upgradeWithContext) ); - return Object.assign({}, message, { attachments }); + return { ...message, attachments }; }; // Public API @@ -180,13 +179,13 @@ exports._mapAttachments = upgradeAttachment => async (message, context) => { // (Message, Context) -> // Promise Message exports._mapContact = upgradeContact => async (message, context) => { - const contextWithMessage = Object.assign({}, context, { message }); + const contextWithMessage = { ...context, message }; const upgradeWithContext = contact => upgradeContact(contact, contextWithMessage); const contact = await Promise.all( (message.contact || []).map(upgradeWithContext) ); - return Object.assign({}, message, { contact }); + return { ...message, contact }; }; // _mapQuotedAttachments :: (QuotedAttachment -> Promise QuotedAttachment) -> @@ -210,9 +209,7 @@ exports._mapQuotedAttachments = upgradeAttachment => async ( } const upgradedThumbnail = await upgradeAttachment(thumbnail, context); - return Object.assign({}, attachment, { - thumbnail: upgradedThumbnail, - }); + return { ...attachment, thumbnail: upgradedThumbnail }; }; const quotedAttachments = (message.quote && message.quote.attachments) || []; @@ -220,11 +217,7 @@ exports._mapQuotedAttachments = upgradeAttachment => async ( const attachments = await Promise.all( quotedAttachments.map(upgradeWithContext) ); - return Object.assign({}, message, { - quote: Object.assign({}, message.quote, { - attachments, - }), - }); + return { ...message, quote: { ...message.quote, attachments } }; }; // _mapPreviewAttachments :: (PreviewAttachment -> Promise PreviewAttachment) -> @@ -248,17 +241,13 @@ exports._mapPreviewAttachments = upgradeAttachment => async ( } const upgradedImage = await upgradeAttachment(image, context); - return Object.assign({}, preview, { - image: upgradedImage, - }); + return { ...preview, image: upgradedImage }; }; const preview = await Promise.all( (message.preview || []).map(upgradeWithContext) ); - return Object.assign({}, message, { - preview, - }); + return { ...message, preview }; }; const toVersion0 = async (message, context) => @@ -533,12 +522,10 @@ exports.createAttachmentLoader = loadAttachmentData => { ); } - return async message => - Object.assign({}, message, { - attachments: await Promise.all( - message.attachments.map(loadAttachmentData) - ), - }); + return async message => ({ + ...message, + attachments: await Promise.all(message.attachments.map(loadAttachmentData)), + }); }; exports.loadQuoteData = loadAttachmentData => { @@ -767,11 +754,10 @@ exports.createAttachmentDataWriter = ({ await writeExistingAttachmentData(avatar.avatar); - return Object.assign({}, messageContact, { - avatar: Object.assign({}, avatar, { - avatar: omit(avatar.avatar, ['data']), - }), - }); + return { + ...messageContact, + avatar: { ...avatar, avatar: omit(avatar.avatar, ['data']) }, + }; }; const writePreviewImage = async item => { @@ -782,41 +768,36 @@ exports.createAttachmentDataWriter = ({ await writeExistingAttachmentData(image); - return Object.assign({}, item, { - image: omit(image, ['data']), - }); + return { ...item, image: omit(image, ['data']) }; }; - const messageWithoutAttachmentData = Object.assign( - {}, - await writeThumbnails(message, { logger }), - { - contact: await Promise.all((contact || []).map(writeContactAvatar)), - preview: await Promise.all((preview || []).map(writePreviewImage)), - attachments: await Promise.all( - (attachments || []).map(async attachment => { - await writeExistingAttachmentData(attachment); + const messageWithoutAttachmentData = { + ...(await writeThumbnails(message, { logger })), + contact: await Promise.all((contact || []).map(writeContactAvatar)), + preview: await Promise.all((preview || []).map(writePreviewImage)), + attachments: await Promise.all( + (attachments || []).map(async attachment => { + await writeExistingAttachmentData(attachment); - if (attachment.screenshot && attachment.screenshot.data) { - await writeExistingAttachmentData(attachment.screenshot); - } - if (attachment.thumbnail && attachment.thumbnail.data) { - await writeExistingAttachmentData(attachment.thumbnail); - } + if (attachment.screenshot && attachment.screenshot.data) { + await writeExistingAttachmentData(attachment.screenshot); + } + if (attachment.thumbnail && attachment.thumbnail.data) { + await writeExistingAttachmentData(attachment.thumbnail); + } - return { - ...omit(attachment, ['data']), - ...(attachment.thumbnail - ? { thumbnail: omit(attachment.thumbnail, ['data']) } - : null), - ...(attachment.screenshot - ? { screenshot: omit(attachment.screenshot, ['data']) } - : null), - }; - }) - ), - } - ); + return { + ...omit(attachment, ['data']), + ...(attachment.thumbnail + ? { thumbnail: omit(attachment.thumbnail, ['data']) } + : null), + ...(attachment.screenshot + ? { screenshot: omit(attachment.screenshot, ['data']) } + : null), + }; + }) + ), + }; return messageWithoutAttachmentData; }; diff --git a/js/modules/types/visual_attachment.js b/js/modules/types/visual_attachment.js index 8108f983b..8697a5d1c 100644 --- a/js/modules/types/visual_attachment.js +++ b/js/modules/types/visual_attachment.js @@ -1,9 +1,9 @@ /* global document, URL, Blob */ const loadImage = require('blueimp-load-image'); -const { toLogFormat } = require('./errors'); const dataURLToBlobSync = require('blueimp-canvas-to-blob'); const { blobToArrayBuffer } = require('blob-util'); +const { toLogFormat } = require('./errors'); const { arrayBufferToObjectURL, } = require('../../../ts/util/arrayBufferToObjectURL'); diff --git a/js/notifications.js b/js/notifications.js index 0cba0bce9..1244feb84 100644 --- a/js/notifications.js +++ b/js/notifications.js @@ -9,8 +9,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; const { Settings } = Signal.Types; diff --git a/js/permissions_popup_start.js b/js/permissions_popup_start.js index 1b80db721..2d0395fd9 100644 --- a/js/permissions_popup_start.js +++ b/js/permissions_popup_start.js @@ -1,8 +1,6 @@ /* global $, Whisper, i18n */ $(document).on('keydown', e => { - 'use strict'; - if (e.keyCode === 27) { window.closePermissionsPopup(); } @@ -11,8 +9,6 @@ $(document).on('keydown', e => { const $body = $(document.body); async function applyTheme() { - 'use strict'; - const theme = await window.getThemeSetting(); $body.removeClass('light-theme'); $body.removeClass('dark-theme'); @@ -22,8 +18,6 @@ async function applyTheme() { applyTheme(); window.subscribeToSystemThemeChange(() => { - 'use strict'; - applyTheme(); }); @@ -42,8 +36,6 @@ window.view = new Whisper.ConfirmationDialogView({ message, okText: i18n('allowAccess'), resolve: () => { - 'use strict'; - if (!window.forCamera) { window.setMediaPermissions(true); } else { diff --git a/js/reactions.js b/js/reactions.js index 36ebc282e..33a758f2f 100644 --- a/js/reactions.js +++ b/js/reactions.js @@ -9,8 +9,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.Reactions = new (Backbone.Collection.extend({ forMessage(message) { diff --git a/js/read_receipts.js b/js/read_receipts.js index dc7fa1da1..c0149aabd 100644 --- a/js/read_receipts.js +++ b/js/read_receipts.js @@ -10,8 +10,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.ReadReceipts = new (Backbone.Collection.extend({ forMessage(conversation, message) { diff --git a/js/read_syncs.js b/js/read_syncs.js index 39cad32be..1215a65a4 100644 --- a/js/read_syncs.js +++ b/js/read_syncs.js @@ -8,8 +8,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.ReadSyncs = new (Backbone.Collection.extend({ forMessage(message) { diff --git a/js/rotate_signed_prekey_listener.js b/js/rotate_signed_prekey_listener.js index 95240253c..80b9809c6 100644 --- a/js/rotate_signed_prekey_listener.js +++ b/js/rotate_signed_prekey_listener.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; const ROTATION_INTERVAL = 48 * 60 * 60 * 1000; let timeout; diff --git a/js/settings_start.js b/js/settings_start.js index a945f3c2f..d40283fbd 100644 --- a/js/settings_start.js +++ b/js/settings_start.js @@ -1,8 +1,6 @@ /* global $, Whisper */ $(document).on('keydown', e => { - 'use strict'; - if (e.keyCode === 27) { window.closeSettings(); } @@ -11,8 +9,6 @@ $(document).on('keydown', e => { const $body = $(document.body); async function applyTheme() { - 'use strict'; - const theme = await window.getThemeSetting(); $body.removeClass('light-theme'); $body.removeClass('dark-theme'); @@ -22,12 +18,9 @@ async function applyTheme() { applyTheme(); window.subscribeToSystemThemeChange(() => { - 'use strict'; - applyTheme(); }); -// eslint-disable-next-line strict const getInitialData = async () => ({ deviceName: await window.getDeviceName(), @@ -57,15 +50,11 @@ window.initialRequest = getInitialData(); // eslint-disable-next-line more/no-then window.initialRequest.then( data => { - 'use strict'; - window.initialData = data; window.view = new Whisper.SettingsView(); window.view.$el.appendTo($body); }, error => { - 'use strict'; - window.log.error( 'settings.initialRequest error:', error && error.stack ? error.stack : error diff --git a/js/signal_protocol_store.js b/js/signal_protocol_store.js index d080a375b..edd1a41aa 100644 --- a/js/signal_protocol_store.js +++ b/js/signal_protocol_store.js @@ -5,8 +5,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - const TIMESTAMP_THRESHOLD = 5 * 1000; // 5 seconds const Direction = { SENDING: 1, @@ -635,7 +633,8 @@ await this.archiveSiblingSessions(encodedAddress); return true; - } else if (this.isNonBlockingApprovalRequired(identityRecord)) { + } + if (this.isNonBlockingApprovalRequired(identityRecord)) { window.log.info('Setting approval status...'); identityRecord.nonblockingApproval = nonblockingApproval; diff --git a/js/storage.js b/js/storage.js index 851d17041..57acd339d 100644 --- a/js/storage.js +++ b/js/storage.js @@ -3,8 +3,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; let ready = false; diff --git a/js/view_syncs.js b/js/view_syncs.js index 90640665b..386039f41 100644 --- a/js/view_syncs.js +++ b/js/view_syncs.js @@ -8,8 +8,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.ViewSyncs = new (Backbone.Collection.extend({ forMessage(message) { diff --git a/js/views/app_view.js b/js/views/app_view.js index d05b31394..86d0a7a6b 100644 --- a/js/views/app_view.js +++ b/js/views/app_view.js @@ -4,8 +4,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; function resolveTheme() { diff --git a/js/views/banner_view.js b/js/views/banner_view.js index 61ed44e0b..ef1d652c7 100644 --- a/js/views/banner_view.js +++ b/js/views/banner_view.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.BannerView = Whisper.View.extend({ diff --git a/js/views/clear_data_view.js b/js/views/clear_data_view.js index e113f8ed1..21f34eaa5 100644 --- a/js/views/clear_data_view.js +++ b/js/views/clear_data_view.js @@ -5,8 +5,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; const { Logs } = window.Signal; diff --git a/js/views/confirmation_dialog_view.js b/js/views/confirmation_dialog_view.js index 0576cea63..db10462c3 100644 --- a/js/views/confirmation_dialog_view.js +++ b/js/views/confirmation_dialog_view.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.ConfirmationDialogView = Whisper.View.extend({ diff --git a/js/views/contact_list_view.js b/js/views/contact_list_view.js index 9bf97bf30..aa4028143 100644 --- a/js/views/contact_list_view.js +++ b/js/views/contact_list_view.js @@ -3,8 +3,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.ContactListView = Whisper.ListView.extend({ diff --git a/js/views/conversation_view.js b/js/views/conversation_view.js index 755bc44c2..e9855402c 100644 --- a/js/views/conversation_view.js +++ b/js/views/conversation_view.js @@ -14,8 +14,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - const FIVE_MINUTES = 1000 * 60 * 5; window.Whisper = window.Whisper || {}; @@ -2717,14 +2715,15 @@ Component: window.Signal.Components.Quote, elCallback: el => this.$(this.compositionApi.current.attSlotRef.current).prepend(el), - props: Object.assign({}, props, { + props: { + ...props, withContentAbove: true, onClose: () => { // This can't be the normal 'onClose' because that is always run when this // view is removed from the DOM, and would clear the draft quote. this.setQuoteMessage(null); }, - }), + }, }); }, diff --git a/js/views/debug_log_view.js b/js/views/debug_log_view.js index 20775696a..ead667812 100644 --- a/js/views/debug_log_view.js +++ b/js/views/debug_log_view.js @@ -3,8 +3,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.LinkedCopiedToast = Whisper.ToastView.extend({ diff --git a/js/views/group_member_list_view.js b/js/views/group_member_list_view.js index 50a121cdc..c35fe77d1 100644 --- a/js/views/group_member_list_view.js +++ b/js/views/group_member_list_view.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; // TODO: take a title string which could replace the 'members' header diff --git a/js/views/identicon_svg_view.js b/js/views/identicon_svg_view.js index efe30dffe..2476e983c 100644 --- a/js/views/identicon_svg_view.js +++ b/js/views/identicon_svg_view.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; /* diff --git a/js/views/inbox_view.js b/js/views/inbox_view.js index e3f109619..46dfbb596 100644 --- a/js/views/inbox_view.js +++ b/js/views/inbox_view.js @@ -7,8 +7,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.StickerPackInstallFailedToast = Whisper.ToastView.extend({ diff --git a/js/views/install_view.js b/js/views/install_view.js index 69b828d67..7139c10e3 100644 --- a/js/views/install_view.js +++ b/js/views/install_view.js @@ -4,8 +4,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; const Steps = { diff --git a/js/views/key_verification_view.js b/js/views/key_verification_view.js index 698b7dcab..0801bf649 100644 --- a/js/views/key_verification_view.js +++ b/js/views/key_verification_view.js @@ -4,8 +4,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.KeyVerificationPanelView = Whisper.View.extend({ diff --git a/js/views/list_view.js b/js/views/list_view.js index deb55bbb3..dc969b6ef 100644 --- a/js/views/list_view.js +++ b/js/views/list_view.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; /* diff --git a/js/views/phone-input-view.js b/js/views/phone-input-view.js index bf69a1edb..600b5b9ff 100644 --- a/js/views/phone-input-view.js +++ b/js/views/phone-input-view.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.PhoneInputView = Whisper.View.extend({ diff --git a/js/views/react_wrapper_view.js b/js/views/react_wrapper_view.js index 7d108fb15..1e2798cd1 100644 --- a/js/views/react_wrapper_view.js +++ b/js/views/react_wrapper_view.js @@ -5,8 +5,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; window.Whisper.ReactWrapperView = Backbone.View.extend({ @@ -66,12 +64,13 @@ }); }, augmentProps(props) { - return Object.assign({}, props, { + return { + ...props, close: () => { this.remove(); }, i18n, - }); + }; }, remove() { if (this.onClose) { diff --git a/js/views/recorder_view.js b/js/views/recorder_view.js index 9e756a76f..6ee521a16 100644 --- a/js/views/recorder_view.js +++ b/js/views/recorder_view.js @@ -4,8 +4,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.RecorderView = Whisper.View.extend({ diff --git a/js/views/safety_number_change_dialog_view.js b/js/views/safety_number_change_dialog_view.js index ea756c681..6ad41c71e 100644 --- a/js/views/safety_number_change_dialog_view.js +++ b/js/views/safety_number_change_dialog_view.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.SafetyNumberChangeDialogView = Whisper.View.extend({ diff --git a/js/views/settings_view.js b/js/views/settings_view.js index 2a5a82ac0..d76f28cd9 100644 --- a/js/views/settings_view.js +++ b/js/views/settings_view.js @@ -6,8 +6,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; const { Settings } = window.Signal.Types; diff --git a/js/views/standalone_registration_view.js b/js/views/standalone_registration_view.js index 9ccd7fc0b..a6111aadc 100644 --- a/js/views/standalone_registration_view.js +++ b/js/views/standalone_registration_view.js @@ -4,8 +4,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.StandaloneRegistrationView = Whisper.View.extend({ diff --git a/js/views/toast_view.js b/js/views/toast_view.js index e1f1d52df..9c3f692cc 100644 --- a/js/views/toast_view.js +++ b/js/views/toast_view.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.ToastView = Whisper.View.extend({ diff --git a/js/views/whisper_view.js b/js/views/whisper_view.js index 1ac49f2b1..23b7739a2 100644 --- a/js/views/whisper_view.js +++ b/js/views/whisper_view.js @@ -22,8 +22,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; Whisper.View = Backbone.View.extend( diff --git a/js/wall_clock_listener.js b/js/wall_clock_listener.js index f8e21a48c..eda3da40b 100644 --- a/js/wall_clock_listener.js +++ b/js/wall_clock_listener.js @@ -2,8 +2,6 @@ // eslint-disable-next-line func-names (function() { - 'use strict'; - window.Whisper = window.Whisper || {}; let lastTime; diff --git a/main.js b/main.js index 6c286f8c9..1d7ea6948 100644 --- a/main.js +++ b/main.js @@ -275,31 +275,29 @@ if (OS === 'win32') { async function createWindow() { const { screen } = electron; - const windowOptions = Object.assign( - { - show: !startInTray, // allow to start minimised in tray - width: DEFAULT_WIDTH, - height: DEFAULT_HEIGHT, - minWidth: MIN_WIDTH, - minHeight: MIN_HEIGHT, - autoHideMenuBar: false, - backgroundColor: - config.environment === 'test' || config.environment === 'test-lib' - ? '#ffffff' // Tests should always be rendered on a white background - : '#3a76f0', - webPreferences: { - nodeIntegration: false, - nodeIntegrationInWorker: false, - contextIsolation: false, - preload: path.join(__dirname, 'preload.js'), - nativeWindowOpen: true, - spellcheck: await getSpellCheckSetting(), - backgroundThrottling: false, - }, - icon: windowIcon, + const windowOptions = { + show: !startInTray, // allow to start minimised in tray + width: DEFAULT_WIDTH, + height: DEFAULT_HEIGHT, + minWidth: MIN_WIDTH, + minHeight: MIN_HEIGHT, + autoHideMenuBar: false, + backgroundColor: + config.environment === 'test' || config.environment === 'test-lib' + ? '#ffffff' // Tests should always be rendered on a white background + : '#3a76f0', + webPreferences: { + nodeIntegration: false, + nodeIntegrationInWorker: false, + contextIsolation: false, + preload: path.join(__dirname, 'preload.js'), + nativeWindowOpen: true, + spellcheck: await getSpellCheckSetting(), + backgroundThrottling: false, }, - _.pick(windowConfig, ['autoHideMenuBar', 'width', 'height', 'x', 'y']) - ); + icon: windowIcon, + ..._.pick(windowConfig, ['autoHideMenuBar', 'width', 'height', 'x', 'y']), + }; if (!_.isNumber(windowOptions.width) || windowOptions.width < MIN_WIDTH) { windowOptions.width = DEFAULT_WIDTH; @@ -796,6 +794,7 @@ async function showDebugLogWindow() { let permissionsPopupWindow; function showPermissionsPopupWindow(forCalling, forCamera) { + // eslint-disable-next-line no-async-promise-executor return new Promise(async (resolve, reject) => { if (permissionsPopupWindow) { permissionsPopupWindow.show(); diff --git a/test/backup_test.js b/test/backup_test.js index e8d4971a3..55b0dd4d6 100644 --- a/test/backup_test.js +++ b/test/backup_test.js @@ -363,21 +363,24 @@ describe('Backup', () => { return attachment; } - return Object.assign({}, attachment, { + return { + ...attachment, thumbnail: await mapper(attachment.thumbnail, context), - }); + }; }; const quotedAttachments = (message.quote && message.quote.attachments) || []; - return Object.assign({}, message, { - quote: Object.assign({}, message.quote, { + return { + ...message, + quote: { + ...message.quote, attachments: await Promise.all( quotedAttachments.map(wrappedMapper) ), - }), - }); + }, + }; }; } @@ -391,17 +394,20 @@ describe('Backup', () => { return wrappedLoadAttachment(thumbnail); }); - return Object.assign({}, await loadThumbnails(message), { + return { + ...(await loadThumbnails(message)), contact: await Promise.all( (message.contact || []).map(async contact => { return contact && contact.avatar && contact.avatar.avatar - ? Object.assign({}, contact, { - avatar: Object.assign({}, contact.avatar, { + ? { + ...contact, + avatar: { + ...contact.avatar, avatar: await wrappedLoadAttachment( contact.avatar.avatar ), - }), - }) + }, + } : contact; }) ), @@ -429,7 +435,7 @@ describe('Backup', () => { return item; }) ), - }); + }; } let backupDir; diff --git a/test/modules/types/message_test.js b/test/modules/types/message_test.js index 0231c8b68..1cc3a6cdb 100644 --- a/test/modules/types/message_test.js +++ b/test/modules/types/message_test.js @@ -341,13 +341,17 @@ describe('Message', () => { schemaVersion: 1, }; - const v1 = async message => - Object.assign({}, message, { hasUpgradedToVersion1: true }); + const v1 = async message => ({ + ...message, + hasUpgradedToVersion1: true, + }); const v2 = async () => { throw new Error('boom'); }; - const v3 = async message => - Object.assign({}, message, { hasUpgradedToVersion3: true }); + const v3 = async message => ({ + ...message, + hasUpgradedToVersion3: true, + }); const toVersion1 = Message._withSchemaVersion({ schemaVersion: 1, @@ -399,12 +403,18 @@ describe('Message', () => { hasUpgradedToVersion2: true, }; - const v1 = async attachment => - Object.assign({}, attachment, { hasUpgradedToVersion1: true }); - const v2 = async attachment => - Object.assign({}, attachment, { hasUpgradedToVersion2: true }); - const v3 = async attachment => - Object.assign({}, attachment, { hasUpgradedToVersion3: true }); + const v1 = async attachment => ({ + ...attachment, + hasUpgradedToVersion1: true, + }); + const v2 = async attachment => ({ + ...attachment, + hasUpgradedToVersion2: true, + }); + const v3 = async attachment => ({ + ...attachment, + hasUpgradedToVersion3: true, + }); const toVersion1 = Message._withSchemaVersion({ schemaVersion: 1, @@ -451,8 +461,7 @@ describe('Message', () => { }); it('should skip upgrading if message has already been upgraded', async () => { - const upgrade = async message => - Object.assign({}, message, { foo: true }); + const upgrade = async message => ({ ...message, foo: true }); const upgradeWithVersion = Message._withSchemaVersion({ schemaVersion: 3, upgrade, diff --git a/ts/components/conversation/GroupNotification.stories.tsx b/ts/components/conversation/GroupNotification.stories.tsx index 3cfb8cd1f..df97fb151 100644 --- a/ts/components/conversation/GroupNotification.stories.tsx +++ b/ts/components/conversation/GroupNotification.stories.tsx @@ -2,11 +2,8 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; -// @ts-ignore import { setup as setupI18n } from '../../../js/modules/i18n'; -// @ts-ignore import enMessages from '../../../_locales/en/messages.json'; - import { GroupNotification, Props } from './GroupNotification'; const book = storiesOf('Components/Conversation', module); diff --git a/ts/components/conversation/ReactionPicker.stories.tsx b/ts/components/conversation/ReactionPicker.stories.tsx index f434802a3..f16bb8c0b 100644 --- a/ts/components/conversation/ReactionPicker.stories.tsx +++ b/ts/components/conversation/ReactionPicker.stories.tsx @@ -1,12 +1,10 @@ import * as React from 'react'; -// @ts-ignore -import { setup as setupI18n } from '../../../js/modules/i18n'; -// @ts-ignore -import enMessages from '../../../_locales/en/messages.json'; - import { storiesOf } from '@storybook/react'; import { action } from '@storybook/addon-actions'; + +import { setup as setupI18n } from '../../../js/modules/i18n'; +import enMessages from '../../../_locales/en/messages.json'; import { Props as ReactionPickerProps, ReactionPicker } from './ReactionPicker'; import { EmojiPicker } from '../emoji/EmojiPicker'; diff --git a/ts/services/calling.ts b/ts/services/calling.ts index 3f6313ec1..ca38bcb80 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -13,6 +13,7 @@ import { RingRTC, UserId, } from 'ringrtc'; +import is from '@sindresorhus/is'; import { ActionsType as UxActionsType, @@ -20,7 +21,6 @@ import { } from '../state/ducks/calling'; import { CallingMessageClass, EnvelopeClass } from '../textsecure.d'; import { ConversationModelType } from '../model-types.d'; -import is from '@sindresorhus/is'; import { AudioDevice, CallHistoryDetailsType, @@ -356,11 +356,12 @@ export class CallingClass { // infrared if they so desire) if (matchingId.length > 0) { return matchingId[0].deviceId; - } else if (nonInfrared.length > 0) { - return nonInfrared[0].deviceId; - } else { - return undefined; } + if (nonInfrared.length > 0) { + return nonInfrared[0].deviceId; + } + + return undefined; } setPreferredMicrophone(device: AudioDevice): void { @@ -471,12 +472,12 @@ export class CallingClass { if (microphonePermission) { if (isVideoCall) { return this.requestCameraPermissions(); - } else { - return true; } - } else { - return false; + + return true; } + + return false; } private async handleOutgoingSignaling( diff --git a/ts/util/lint/exceptions.json b/ts/util/lint/exceptions.json index f9bcbb751..6eb3e0fbd 100644 --- a/ts/util/lint/exceptions.json +++ b/ts/util/lint/exceptions.json @@ -155,7 +155,7 @@ "rule": "jQuery-$(", "path": "js/about_start.js", "line": "$('.privacy').text(window.i18n('privacyPolicy'));", - "lineNumber": 28, + "lineNumber": 26, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -173,7 +173,7 @@ "rule": "jQuery-$(", "path": "js/debug_log_start.js", "line": "const $body = $(document.body);", - "lineNumber": 12, + "lineNumber": 10, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -182,7 +182,7 @@ "rule": "jQuery-appendTo(", "path": "js/debug_log_start.js", "line": "window.view.$el.appendTo($body);", - "lineNumber": 19, + "lineNumber": 17, "reasonCategory": "usageTrusted", "updated": "2018-09-19T18:13:29.628Z", "reasonDetail": "Interacting with already-existing DOM nodes" @@ -199,7 +199,7 @@ "rule": "jQuery-$(", "path": "js/loading_start.js", "line": " $('.message').text(window.i18n('optimizingApplication'));", - "lineNumber": 6, + "lineNumber": 4, "reasonCategory": "usageTrusted", "updated": "2020-03-25T15:45:04.024Z" }, @@ -239,7 +239,7 @@ "rule": "jQuery-$(", "path": "js/modules/i18n.js", "line": " const FIND_REPLACEMENTS = /\\$([^$]+)\\$/g;", - "lineNumber": 44, + "lineNumber": 45, "reasonCategory": "falseMatch", "updated": "2020-07-21T18:34:59.251Z" }, @@ -264,7 +264,7 @@ "rule": "jQuery-$(", "path": "js/permissions_popup_start.js", "line": "const $body = $(document.body);", - "lineNumber": 11, + "lineNumber": 9, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -273,7 +273,7 @@ "rule": "jQuery-appendTo(", "path": "js/permissions_popup_start.js", "line": "window.view.$el.appendTo($body);", - "lineNumber": 57, + "lineNumber": 49, "reasonCategory": "usageTrusted", "updated": "2020-06-02T21:51:34.813Z", "reasonDetail": "Interacting with already-existing DOM nodes" @@ -291,7 +291,7 @@ "rule": "jQuery-$(", "path": "js/settings_start.js", "line": "const $body = $(document.body);", - "lineNumber": 11, + "lineNumber": 9, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -300,7 +300,7 @@ "rule": "jQuery-appendTo(", "path": "js/settings_start.js", "line": " window.view.$el.appendTo($body);", - "lineNumber": 64, + "lineNumber": 55, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Interacting with already-existing DOM nodes" @@ -309,7 +309,7 @@ "rule": "jQuery-load(", "path": "js/signal_protocol_store.js", "line": " await ConversationController.load();", - "lineNumber": 981, + "lineNumber": 980, "reasonCategory": "falseMatch", "updated": "2020-06-12T14:20:09.936Z" }, @@ -317,7 +317,7 @@ "rule": "DOM-innerHTML", "path": "js/views/app_view.js", "line": " this.el.innerHTML = '';", - "lineNumber": 54, + "lineNumber": 52, "reasonCategory": "usageTrusted", "updated": "2018-09-15T00:38:04.183Z", "reasonDetail": "Hard-coded string" @@ -326,7 +326,7 @@ "rule": "jQuery-append(", "path": "js/views/app_view.js", "line": " this.el.append(view.el);", - "lineNumber": 55, + "lineNumber": 53, "reasonCategory": "usageTrusted", "updated": "2018-09-19T18:13:29.628Z", "reasonDetail": "Interacting with already-existing DOM nodes" @@ -335,7 +335,7 @@ "rule": "jQuery-appendTo(", "path": "js/views/app_view.js", "line": " this.debugLogView.$el.appendTo(this.el);", - "lineNumber": 61, + "lineNumber": 59, "reasonCategory": "usageTrusted", "updated": "2018-09-19T18:13:29.628Z", "reasonDetail": "Interacting with already-existing DOM nodes" @@ -344,7 +344,7 @@ "rule": "jQuery-$(", "path": "js/views/confirmation_dialog_view.js", "line": " setTimeout(() => this.$('.cancel').focus(), 1);", - "lineNumber": 75, + "lineNumber": 73, "reasonCategory": "usageTrusted", "updated": "2019-12-07T02:04:56.987Z", "reasonDetail": "Protected from arbitrary input" @@ -353,7 +353,7 @@ "rule": "jQuery-append(", "path": "js/views/contact_list_view.js", "line": " this.$el.append(this.contactView.el);", - "lineNumber": 37, + "lineNumber": 35, "reasonCategory": "usageTrusted", "updated": "2019-07-31T00:19:18.696Z", "reasonDetail": "Known DOM elements" @@ -362,7 +362,7 @@ "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " this.$('textarea').val(i18n('loading'));", - "lineNumber": 43, + "lineNumber": 41, "reasonCategory": "usageTrusted", "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" @@ -371,7 +371,7 @@ "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " this.$('textarea').val(text);", - "lineNumber": 47, + "lineNumber": 45, "reasonCategory": "usageTrusted", "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" @@ -380,7 +380,7 @@ "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " const text = this.$('textarea').val();", - "lineNumber": 66, + "lineNumber": 64, "reasonCategory": "usageTrusted", "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" @@ -389,7 +389,7 @@ "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " this.$('.buttons, textarea').remove();", - "lineNumber": 71, + "lineNumber": 69, "reasonCategory": "usageTrusted", "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" @@ -398,6 +398,15 @@ "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " el: this.$('.result'),", + "lineNumber": 76, + "reasonCategory": "usageTrusted", + "updated": "2020-05-01T17:11:39.527Z", + "reasonDetail": "Protected from arbitrary input" + }, + { + "rule": "jQuery-$(", + "path": "js/views/debug_log_view.js", + "line": " this.$('.loading').removeClass('loading');", "lineNumber": 78, "reasonCategory": "usageTrusted", "updated": "2020-05-01T17:11:39.527Z", @@ -406,26 +415,17 @@ { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", - "line": " this.$('.loading').removeClass('loading');", + "line": " this.$('.link')", "lineNumber": 80, "reasonCategory": "usageTrusted", "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" }, - { - "rule": "jQuery-$(", - "path": "js/views/debug_log_view.js", - "line": " this.$('.link')", - "lineNumber": 82, - "reasonCategory": "usageTrusted", - "updated": "2020-05-01T17:11:39.527Z", - "reasonDetail": "Protected from arbitrary input" - }, { "rule": "jQuery-$(", "path": "js/views/debug_log_view.js", "line": " this.$('.loading').removeClass('loading');", - "lineNumber": 90, + "lineNumber": 88, "reasonCategory": "usageTrusted", "updated": "2020-05-01T17:11:39.527Z", "reasonDetail": "Protected from arbitrary input" @@ -434,7 +434,7 @@ "rule": "jQuery-$(", "path": "js/views/group_member_list_view.js", "line": " this.$('.container').append(this.member_list_view.el);", - "lineNumber": 27, + "lineNumber": 25, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -443,7 +443,7 @@ "rule": "jQuery-append(", "path": "js/views/group_member_list_view.js", "line": " this.$('.container').append(this.member_list_view.el);", - "lineNumber": 27, + "lineNumber": 25, "reasonCategory": "usageTrusted", "updated": "2018-09-19T18:13:29.628Z", "reasonDetail": "Interacting with already-existing DOM nodes" @@ -452,7 +452,7 @@ "rule": "jQuery-html(", "path": "js/views/identicon_svg_view.js", "line": " const html = this.render().$el.html();", - "lineNumber": 19, + "lineNumber": 17, "reasonCategory": "usageTrusted", "updated": "2018-09-15T00:38:04.183Z", "reasonDetail": "Getting the value, not setting it" @@ -461,7 +461,7 @@ "rule": "jQuery-appendTo(", "path": "js/views/inbox_view.js", "line": " view.$el.appendTo(this.el);", - "lineNumber": 33, + "lineNumber": 31, "reasonCategory": "usageTrusted", "updated": "2019-10-21T22:30:15.622Z", "reasonDetail": "Known DOM elements" @@ -470,7 +470,7 @@ "rule": "jQuery-$(", "path": "js/views/inbox_view.js", "line": " this.$('.message').text(message);", - "lineNumber": 67, + "lineNumber": 65, "reasonCategory": "usageTrusted", "updated": "2019-10-21T22:30:15.622Z", "reasonDetail": "Hardcoded selector" @@ -479,7 +479,7 @@ "rule": "jQuery-$(", "path": "js/views/inbox_view.js", "line": " el: this.$('.conversation-stack'),", - "lineNumber": 83, + "lineNumber": 81, "reasonCategory": "usageTrusted", "updated": "2019-10-21T22:30:15.622Z", "reasonDetail": "Hardcoded selector" @@ -488,7 +488,7 @@ "rule": "jQuery-prependTo(", "path": "js/views/inbox_view.js", "line": " this.appLoadingScreen.$el.prependTo(this.el);", - "lineNumber": 97, + "lineNumber": 95, "reasonCategory": "usageTrusted", "updated": "2019-10-21T22:30:15.622Z", "reasonDetail": "Known DOM elements" @@ -497,7 +497,7 @@ "rule": "jQuery-appendTo(", "path": "js/views/inbox_view.js", "line": " toast.$el.appendTo(this.$el);", - "lineNumber": 106, + "lineNumber": 104, "reasonCategory": "usageTrusted", "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "Known DOM elements" @@ -506,7 +506,7 @@ "rule": "jQuery-$(", "path": "js/views/inbox_view.js", "line": " this.$('.call-manager-placeholder').append(this.callManagerView.el);", - "lineNumber": 128, + "lineNumber": 126, "reasonCategory": "usageTrusted", "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "" @@ -515,7 +515,7 @@ "rule": "jQuery-append(", "path": "js/views/inbox_view.js", "line": " this.$('.call-manager-placeholder').append(this.callManagerView.el);", - "lineNumber": 128, + "lineNumber": 126, "reasonCategory": "usageTrusted", "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "" @@ -524,7 +524,7 @@ "rule": "jQuery-$(", "path": "js/views/inbox_view.js", "line": " this.$('.left-pane-placeholder').append(this.leftPaneView.el);", - "lineNumber": 139, + "lineNumber": 137, "reasonCategory": "usageTrusted", "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "Known DOM elements" @@ -533,7 +533,7 @@ "rule": "jQuery-append(", "path": "js/views/inbox_view.js", "line": " this.$('.left-pane-placeholder').append(this.leftPaneView.el);", - "lineNumber": 139, + "lineNumber": 137, "reasonCategory": "usageTrusted", "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "Known DOM elements" @@ -542,7 +542,7 @@ "rule": "jQuery-$(", "path": "js/views/inbox_view.js", "line": " if (e && this.$(e.target).closest('.placeholder').length) {", - "lineNumber": 192, + "lineNumber": 190, "reasonCategory": "usageTrusted", "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "Known DOM elements" @@ -551,7 +551,7 @@ "rule": "jQuery-$(", "path": "js/views/inbox_view.js", "line": " this.$('#header, .gutter').addClass('inactive');", - "lineNumber": 196, + "lineNumber": 194, "reasonCategory": "usageTrusted", "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "Hardcoded selector" @@ -560,7 +560,7 @@ "rule": "jQuery-$(", "path": "js/views/inbox_view.js", "line": " this.$('.conversation-stack').addClass('inactive');", - "lineNumber": 200, + "lineNumber": 198, "reasonCategory": "usageTrusted", "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "Hardcoded selector" @@ -569,7 +569,7 @@ "rule": "jQuery-$(", "path": "js/views/inbox_view.js", "line": " this.$('.conversation:first .menu').trigger('close');", - "lineNumber": 202, + "lineNumber": 200, "reasonCategory": "usageTrusted", "updated": "2020-05-28T17:42:35.329Z", "reasonDetail": "Hardcoded selector" @@ -578,7 +578,7 @@ "rule": "jQuery-$(", "path": "js/views/inbox_view.js", "line": " if (e && this.$(e.target).closest('.capture-audio').length > 0) {", - "lineNumber": 222, + "lineNumber": 220, "reasonCategory": "usageTrusted", "updated": "2020-05-29T18:29:18.234Z", "reasonDetail": "Known DOM elements" @@ -587,7 +587,7 @@ "rule": "jQuery-$(", "path": "js/views/inbox_view.js", "line": " this.$('.conversation:first .recorder').trigger('close');", - "lineNumber": 225, + "lineNumber": 223, "reasonCategory": "usageTrusted", "updated": "2020-05-29T18:29:18.234Z", "reasonDetail": "Hardcoded selector" @@ -596,7 +596,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$('#qr img').remove();", - "lineNumber": 160, + "lineNumber": 158, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -605,7 +605,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$('#qr .container').show();", - "lineNumber": 162, + "lineNumber": 160, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -614,7 +614,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " if ($('#qr').length === 0) {", - "lineNumber": 166, + "lineNumber": 164, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -623,7 +623,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$('#qr .container').hide();", - "lineNumber": 172, + "lineNumber": 170, "reasonCategory": "usageTrusted", "updated": "2020-03-24T19:03:04.861Z", "reasonDetail": "Protected from arbitrary input" @@ -632,7 +632,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.qr = new QRCode(this.$('#qr')[0]).makeCode(url);", - "lineNumber": 173, + "lineNumber": 171, "reasonCategory": "usageTrusted", "updated": "2020-03-24T19:03:04.861Z", "reasonDetail": "Protected from arbitrary input" @@ -641,7 +641,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$('#qr').addClass('ready');", - "lineNumber": 175, + "lineNumber": 173, "reasonCategory": "usageTrusted", "updated": "2020-03-24T19:03:04.861Z", "reasonDetail": "Protected from arbitrary input" @@ -650,7 +650,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$(DEVICE_NAME_SELECTOR).val(deviceName || window.getHostName());", - "lineNumber": 180, + "lineNumber": 178, "reasonCategory": "usageTrusted", "updated": "2020-03-24T19:03:04.861Z", "reasonDetail": "Protected from arbitrary input" @@ -659,7 +659,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$('#link-phone').submit();", - "lineNumber": 185, + "lineNumber": 183, "reasonCategory": "usageTrusted", "updated": "2020-03-24T19:03:04.861Z", "reasonDetail": "Protected from arbitrary input" @@ -668,7 +668,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$('#link-phone').submit(e => {", - "lineNumber": 195, + "lineNumber": 193, "reasonCategory": "usageTrusted", "updated": "2020-03-24T19:03:04.861Z", "reasonDetail": "Protected from arbitrary input" @@ -677,7 +677,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " let name = this.$(DEVICE_NAME_SELECTOR).val();", - "lineNumber": 199, + "lineNumber": 197, "reasonCategory": "usageTrusted", "updated": "2020-03-24T19:03:04.861Z", "reasonDetail": "Protected from arbitrary input" @@ -686,7 +686,7 @@ "rule": "jQuery-$(", "path": "js/views/install_view.js", "line": " this.$(DEVICE_NAME_SELECTOR).focus();", - "lineNumber": 202, + "lineNumber": 200, "reasonCategory": "usageTrusted", "updated": "2020-03-24T19:03:04.861Z", "reasonDetail": "Protected from arbitrary input" @@ -695,7 +695,7 @@ "rule": "jQuery-$(", "path": "js/views/key_verification_view.js", "line": " this.$('.key-verification-wrapper').append(this.view.el);", - "lineNumber": 28, + "lineNumber": 26, "reasonCategory": "usageTrusted", "updated": "2020-06-23T06:48:06.829Z" }, @@ -703,7 +703,7 @@ "rule": "jQuery-append(", "path": "js/views/key_verification_view.js", "line": " this.$('.key-verification-wrapper').append(this.view.el);", - "lineNumber": 28, + "lineNumber": 26, "reasonCategory": "usageTrusted", "updated": "2020-06-23T06:48:06.829Z" }, @@ -711,7 +711,7 @@ "rule": "jQuery-append(", "path": "js/views/list_view.js", "line": " this.$el.append(view.render().el);", - "lineNumber": 27, + "lineNumber": 25, "reasonCategory": "usageTrusted", "updated": "2018-09-19T18:13:29.628Z", "reasonDetail": "Interacting with already-existing DOM nodes" @@ -720,7 +720,7 @@ "rule": "jQuery-html(", "path": "js/views/list_view.js", "line": " this.$el.html('');", - "lineNumber": 33, + "lineNumber": 31, "reasonCategory": "usageTrusted", "updated": "2018-09-15T00:38:04.183Z", "reasonDetail": "Hard-coded value" @@ -729,7 +729,7 @@ "rule": "jQuery-$(", "path": "js/views/phone-input-view.js", "line": " this.$('input.number').intlTelInput();", - "lineNumber": 14, + "lineNumber": 12, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -738,7 +738,7 @@ "rule": "jQuery-$(", "path": "js/views/phone-input-view.js", "line": " const input = this.$('input.number');", - "lineNumber": 21, + "lineNumber": 19, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -747,7 +747,7 @@ "rule": "jQuery-$(", "path": "js/views/phone-input-view.js", "line": " const regionCode = this.$('li.active')", - "lineNumber": 22, + "lineNumber": 20, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -756,7 +756,7 @@ "rule": "jQuery-$(", "path": "js/views/phone-input-view.js", "line": " this.$('.number-container').removeClass('invalid');", - "lineNumber": 29, + "lineNumber": 27, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -765,7 +765,7 @@ "rule": "jQuery-$(", "path": "js/views/phone-input-view.js", "line": " this.$('.number-container').removeClass('valid');", - "lineNumber": 32, + "lineNumber": 30, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -774,7 +774,7 @@ "rule": "jQuery-$(", "path": "js/views/recorder_view.js", "line": " $(window).on('blur', this.onSwitchAwayBound);", - "lineNumber": 19, + "lineNumber": 17, "reasonCategory": "usageTrusted", "updated": "2018-10-11T19:22:47.331Z", "reasonDetail": "Operating on already-existing DOM elements" @@ -783,7 +783,7 @@ "rule": "jQuery-$(", "path": "js/views/recorder_view.js", "line": " this.$('.time').text(`${minutes}:${seconds}`);", - "lineNumber": 51, + "lineNumber": 49, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -792,7 +792,7 @@ "rule": "jQuery-$(", "path": "js/views/recorder_view.js", "line": " $(window).off('blur', this.onSwitchAwayBound);", - "lineNumber": 82, + "lineNumber": 80, "reasonCategory": "usageTrusted", "updated": "2018-10-11T19:22:47.331Z", "reasonDetail": "Operating on already-existing DOM elements" @@ -801,7 +801,7 @@ "rule": "jQuery-$(", "path": "js/views/safety_number_change_dialog_view.js", "line": " this.$('.safety-number-change-dialog-wrapper').append(dialog.el);", - "lineNumber": 37, + "lineNumber": 35, "reasonCategory": "usageTrusted", "updated": "2020-06-23T06:48:06.829Z" }, @@ -809,7 +809,7 @@ "rule": "jQuery-append(", "path": "js/views/safety_number_change_dialog_view.js", "line": " this.$('.safety-number-change-dialog-wrapper').append(dialog.el);", - "lineNumber": 37, + "lineNumber": 35, "reasonCategory": "usageTrusted", "updated": "2020-06-23T06:48:06.829Z" }, @@ -817,7 +817,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " this.$('input').prop('checked', !!this.value);", - "lineNumber": 30, + "lineNumber": 28, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -826,7 +826,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " this.$('input').prop('checked', Boolean(this.value));", - "lineNumber": 49, + "lineNumber": 47, "reasonCategory": "usageTrusted", "updated": "2020-06-02T22:20:33.618Z" }, @@ -834,7 +834,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " this.$('input').prop('checked', Boolean(this.value));", - "lineNumber": 68, + "lineNumber": 66, "reasonCategory": "usageTrusted", "updated": "2020-06-02T21:51:34.813Z", "reasonDetail": "Protected from arbitrary input" @@ -843,7 +843,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " const value = this.$(e.target).val();", - "lineNumber": 83, + "lineNumber": 81, "reasonCategory": "usageTrusted", "updated": "2020-06-02T21:51:34.813Z", "reasonDetail": "Protected from arbitrary input" @@ -852,7 +852,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " this.$(`#${this.name}-${this.value}`).attr('checked', 'checked');", - "lineNumber": 88, + "lineNumber": 86, "reasonCategory": "usageTrusted", "updated": "2020-06-02T21:51:34.813Z", "reasonDetail": "Protected from arbitrary input" @@ -861,7 +861,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.notification-settings'),", - "lineNumber": 97, + "lineNumber": 95, "reasonCategory": "usageTrusted", "updated": "2020-06-02T21:51:34.813Z", "reasonDetail": "Protected from arbitrary input" @@ -870,7 +870,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.theme-settings'),", - "lineNumber": 103, + "lineNumber": 101, "reasonCategory": "usageTrusted", "updated": "2020-06-02T21:51:34.813Z", "reasonDetail": "Protected from arbitrary input" @@ -879,7 +879,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " $(document.body)", - "lineNumber": 107, + "lineNumber": 105, "reasonCategory": "usageTrusted", "updated": "2020-06-02T21:51:34.813Z", "reasonDetail": "Protected from arbitrary input" @@ -888,7 +888,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.draw-attention-setting'),", - "lineNumber": 118, + "lineNumber": 116, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -897,7 +897,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.audio-notification-setting'),", - "lineNumber": 126, + "lineNumber": 124, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -906,7 +906,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.spell-check-setting'),", - "lineNumber": 133, + "lineNumber": 131, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -915,7 +915,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " const $msg = this.$('.spell-check-setting-message');", - "lineNumber": 137, + "lineNumber": 135, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -924,7 +924,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.menu-bar-setting'),", - "lineNumber": 150, + "lineNumber": 148, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -933,7 +933,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.always-relay-calls-setting'),", - "lineNumber": 157, + "lineNumber": 155, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -942,7 +942,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.call-ringtone-notification-setting'),", - "lineNumber": 163, + "lineNumber": 161, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -951,7 +951,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.call-system-notification-setting'),", - "lineNumber": 169, + "lineNumber": 167, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -960,7 +960,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.incoming-call-notification-setting'),", - "lineNumber": 175, + "lineNumber": 173, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -969,7 +969,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.media-permissions'),", - "lineNumber": 181, + "lineNumber": 179, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -978,7 +978,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " el: this.$('.media-camera-permissions'),", - "lineNumber": 186, + "lineNumber": 184, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -987,7 +987,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " this.$('.sync-setting').append(syncView.el);", - "lineNumber": 192, + "lineNumber": 190, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -996,7 +996,7 @@ "rule": "jQuery-append(", "path": "js/views/settings_view.js", "line": " this.$('.sync-setting').append(syncView.el);", - "lineNumber": 192, + "lineNumber": 190, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Interacting with already-existing DOM nodes" @@ -1005,7 +1005,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " this.$('.sync').text(i18n('syncNow'));", - "lineNumber": 273, + "lineNumber": 271, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -1014,7 +1014,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " this.$('.sync').attr('disabled', 'disabled');", - "lineNumber": 277, + "lineNumber": 275, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -1023,7 +1023,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " this.$('.synced_at').hide();", - "lineNumber": 289, + "lineNumber": 287, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -1032,7 +1032,7 @@ "rule": "jQuery-$(", "path": "js/views/settings_view.js", "line": " this.$('.sync_failed').hide();", - "lineNumber": 294, + "lineNumber": 292, "reasonCategory": "usageTrusted", "updated": "2020-08-21T11:29:29.636Z", "reasonDetail": "Protected from arbitrary input" @@ -1041,7 +1041,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('input.number').val(number);", - "lineNumber": 23, + "lineNumber": 21, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1050,25 +1050,25 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " el: this.$('#phone-number-input'),", + "lineNumber": 24, + "reasonCategory": "usageTrusted", + "updated": "2018-09-19T21:59:32.770Z", + "reasonDetail": "Protected from arbitrary input" + }, + { + "rule": "jQuery-$(", + "path": "js/views/standalone_registration_view.js", + "line": " this.$('#error').hide();", "lineNumber": 26, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" }, - { - "rule": "jQuery-$(", - "path": "js/views/standalone_registration_view.js", - "line": " this.$('#error').hide();", - "lineNumber": 28, - "reasonCategory": "usageTrusted", - "updated": "2018-09-19T21:59:32.770Z", - "reasonDetail": "Protected from arbitrary input" - }, { "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " const verificationCode = $('#code')", - "lineNumber": 39, + "lineNumber": 37, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1077,7 +1077,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#status').text(s);", - "lineNumber": 52, + "lineNumber": 50, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1086,7 +1086,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " const verificationCode = $('#code')", - "lineNumber": 55, + "lineNumber": 53, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1095,7 +1095,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#error')", - "lineNumber": 66, + "lineNumber": 64, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1104,7 +1104,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " if (this.$('#number-container').hasClass('valid')) {", - "lineNumber": 73, + "lineNumber": 71, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1113,7 +1113,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#request-sms, #request-voice').prop('disabled', 'disabled');", - "lineNumber": 76, + "lineNumber": 74, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1122,7 +1122,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#code').addClass('invalid');", - "lineNumber": 81, + "lineNumber": 79, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1131,7 +1131,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#code').removeClass('invalid');", - "lineNumber": 83, + "lineNumber": 81, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1140,7 +1140,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#error').hide();", - "lineNumber": 88, + "lineNumber": 86, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1149,7 +1149,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#step2')", - "lineNumber": 94, + "lineNumber": 92, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1158,7 +1158,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#number-container').addClass('invalid');", - "lineNumber": 98, + "lineNumber": 96, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1167,7 +1167,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " $('#error').hide();", - "lineNumber": 103, + "lineNumber": 101, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1176,7 +1176,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#step2')", - "lineNumber": 109, + "lineNumber": 107, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1185,7 +1185,7 @@ "rule": "jQuery-$(", "path": "js/views/standalone_registration_view.js", "line": " this.$('#number-container').addClass('invalid');", - "lineNumber": 113, + "lineNumber": 111, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1194,7 +1194,7 @@ "rule": "jQuery-html(", "path": "js/views/toast_view.js", "line": " this.$el.html(", - "lineNumber": 22, + "lineNumber": 20, "reasonCategory": "usageTrusted", "updated": "2018-09-15T00:38:04.183Z" }, @@ -1202,7 +1202,7 @@ "rule": "jQuery-appendTo(", "path": "js/views/toast_view.js", "line": " toast.$el.appendTo(el);", - "lineNumber": 36, + "lineNumber": 34, "reasonCategory": "usageTrusted", "updated": "2019-11-06T19:56:38.557Z", "reasonDetail": "Protected from arbitrary input" @@ -1211,7 +1211,7 @@ "rule": "jQuery-html(", "path": "js/views/whisper_view.js", "line": " this.$el.html(Mustache.render(template, attrs, partials));", - "lineNumber": 51, + "lineNumber": 49, "reasonCategory": "usageTrusted", "updated": "2018-09-15T00:38:04.183Z", "reasonDetail": "Value set came directly from Mustache tempating engine" @@ -1220,7 +1220,7 @@ "rule": "jQuery-append(", "path": "js/views/whisper_view.js", "line": " this.$el.append(dialog.el);", - "lineNumber": 62, + "lineNumber": 60, "reasonCategory": "usageTrusted", "updated": "2018-09-19T18:13:29.628Z", "reasonDetail": "Interacting with already-existing DOM nodes" @@ -1229,7 +1229,7 @@ "rule": "jQuery-$(", "path": "js/views/whisper_view.js", "line": " $('script[type=\"text/x-tmpl-mustache\"]').each((i, el) => {", - "lineNumber": 71, + "lineNumber": 69, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1238,7 +1238,7 @@ "rule": "jQuery-$(", "path": "js/views/whisper_view.js", "line": " const $el = $(el);", - "lineNumber": 72, + "lineNumber": 70, "reasonCategory": "usageTrusted", "updated": "2018-09-19T21:59:32.770Z", "reasonDetail": "Protected from arbitrary input" @@ -1247,7 +1247,7 @@ "rule": "jQuery-html(", "path": "js/views/whisper_view.js", "line": " templates[id] = $el.html();", - "lineNumber": 74, + "lineNumber": 72, "reasonCategory": "usageTrusted", "updated": "2018-09-15T00:38:04.183Z", "reasonDetail": "Getting the value, not setting it" @@ -2134,7 +2134,7 @@ "line": " if (_this.wrap) wrapped = wrap(col.text, _this._negatePadding(col), { hard: true }).split('\\n')", "lineNumber": 216, "reasonCategory": "falseMatch", - "updated": "2020-09-04T14:54:43.116Z" + "updated": "2020-09-04T18:54:59.993Z" }, { "rule": "jQuery-load(", @@ -9824,7 +9824,7 @@ "line": " if (_this.wrap) wrapped = wrap(col.text, _this._negatePadding(col), {hard: true}).split('\\n')", "lineNumber": 212, "reasonCategory": "falseMatch", - "updated": "2020-09-04T14:54:43.116Z" + "updated": "2020-09-04T18:54:59.993Z" }, { "rule": "jQuery-wrap(", @@ -12954,7 +12954,7 @@ "line": " const byteBuffer = window.dcodeIO.ByteBuffer.wrap(quote, 'binary', window.dcodeIO.ByteBuffer.LITTLE_ENDIAN);", "lineNumber": 1049, "reasonCategory": "falseMatch", - "updated": "2020-09-04T00:33:28.532Z" + "updated": "2020-09-08T23:07:22.682Z" }, { "rule": "jQuery-wrap(", @@ -12962,6 +12962,6 @@ "line": " const byteBuffer = window.dcodeIO.ByteBuffer.wrap(", "lineNumber": 1748, "reasonCategory": "falseMatch", - "updated": "2020-09-04T00:33:28.532Z" + "updated": "2020-09-08T23:07:22.682Z" } -] \ No newline at end of file +]