From b31b6bb91267ee4eeea96755040e5496456b9694 Mon Sep 17 00:00:00 2001 From: Maxim Shishmarev Date: Thu, 2 Jul 2020 12:47:31 +1000 Subject: [PATCH] Lint --- js/modules/attachment_downloads.js | 2 +- ts/receiver/receiver.ts | 21 +++++------------ ts/session/snode_api/swarmPolling.ts | 1 - ts/test/session/utils/SyncMessage_test.ts | 28 ++++++++++------------- 4 files changed, 19 insertions(+), 33 deletions(-) diff --git a/js/modules/attachment_downloads.js b/js/modules/attachment_downloads.js index 7518fc4ee..aed57b391 100644 --- a/js/modules/attachment_downloads.js +++ b/js/modules/attachment_downloads.js @@ -1,6 +1,6 @@ /* global Whisper, Signal, setTimeout, clearTimeout, MessageController, NewReceiver */ -const { isFunction, isNumber, omit } = require('lodash'); +const { isNumber, omit } = require('lodash'); const getGuid = require('uuid/v4'); const { getMessageById, diff --git a/ts/receiver/receiver.ts b/ts/receiver/receiver.ts index e26f5fd57..0fdf69fd4 100644 --- a/ts/receiver/receiver.ts +++ b/ts/receiver/receiver.ts @@ -301,9 +301,7 @@ async function handleDecryptedEnvelope( } } - -export async function handleUnencryptedMessage({message : outerMessage} : any) { - +export async function handleUnencryptedMessage({ message: outerMessage }: any) { const { source } = outerMessage; const { group, profile, profileKey } = outerMessage.message; @@ -315,27 +313,20 @@ export async function handleUnencryptedMessage({message : outerMessage} : any) { source, 'private' ); - await updateProfile( - conversation, - profile, - profileKey - ); + await updateProfile(conversation, profile, profileKey); } const primaryDevice = window.storage.get('primaryDevicePubKey'); - const isOurDevice = source && - (source === ourNumber || source === primaryDevice); + const isOurDevice = + source && (source === ourNumber || source === primaryDevice); const isPublicChatMessage = - group && - group.id && - !!group.id.match(/^publicChat:/); + group && group.id && !!group.id.match(/^publicChat:/); const ev = { // Public chat messages from ourselves should be outgoing - type: (isPublicChatMessage && isOurDevice) ? 'sent' : 'message', + type: isPublicChatMessage && isOurDevice ? 'sent' : 'message', data: outerMessage, }; await handleMessageEvent(ev); - } diff --git a/ts/session/snode_api/swarmPolling.ts b/ts/session/snode_api/swarmPolling.ts index abb63516c..24631d52c 100644 --- a/ts/session/snode_api/swarmPolling.ts +++ b/ts/session/snode_api/swarmPolling.ts @@ -164,7 +164,6 @@ export class SwarmPolling { node: Snode, pubkey: PubKey ): Promise> { - const edkey = node.pubkey_ed25519; const pkStr = pubkey.key ? pubkey.key : pubkey; diff --git a/ts/test/session/utils/SyncMessage_test.ts b/ts/test/session/utils/SyncMessage_test.ts index df14f6627..ff6f168d9 100644 --- a/ts/test/session/utils/SyncMessage_test.ts +++ b/ts/test/session/utils/SyncMessage_test.ts @@ -21,22 +21,18 @@ describe('Sync Message Utils', () => { // Fill half with secondaries, half with primaries const numConversations = 20; - const primaryConversations = new Array(numConversations / 2) - .fill({}) - .map( - () => - new TestUtils.MockConversation({ - type: TestUtils.MockConversationType.Primary, - }) - ); - const secondaryConversations = new Array(numConversations / 2) - .fill({}) - .map( - () => - new TestUtils.MockConversation({ - type: TestUtils.MockConversationType.Secondary, - }) - ); + const primaryConversations = new Array(numConversations / 2).fill({}).map( + () => + new TestUtils.MockConversation({ + type: TestUtils.MockConversationType.Primary, + }) + ); + const secondaryConversations = new Array(numConversations / 2).fill({}).map( + () => + new TestUtils.MockConversation({ + type: TestUtils.MockConversationType.Secondary, + }) + ); const conversations = [...primaryConversations, ...secondaryConversations]; const sandbox = sinon.createSandbox();