From 6e1f3fdc75bca19636e6e57e3bb0a1e6735edda3 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 6 Jul 2020 14:19:13 +1000 Subject: [PATCH 1/8] linked-devices-limit --- _locales/en/messages.json | 8 +++++++- js/background.js | 23 +++++++++++++++++----- preload.js | 1 + ts/components/session/RegistrationTabs.tsx | 2 +- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 522bc76f4..a650828b3 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -862,6 +862,12 @@ "devicePairingReceived": { "message": "Device Linking Received" }, + "devicePairingRequestReceivedLimitTitle": { + "message": "Device linking limit reached." + }, + "devicePairingRequestReceivedLimitDescription": { + "message": "To change your linked devices, please unlink a device first." + }, "devicePairingRequestReceivedNoListenerTitle": { "message": "Device linking request received." }, @@ -2374,7 +2380,7 @@ "message": "Verify Password" }, "devicePairingHeader": { - "message": "Open Session on your other device and navigate to the Linked Devices section in your user account screen. Select Link a Device to prepare your other device for pairing, then enter your Session ID below to link this device to your Session ID." + "message": "1. Open Session on your other device.
2. Navigate to the Linked Devices section in your user account screen.
3. Select 'Link a Device' to prepare your other device for pairing
4. Enter your Session ID below to link this device to your Session ID." }, "enterSessionIDHere": { "message": "Enter other device’s Session ID here" diff --git a/js/background.js b/js/background.js index 89f5d242f..69dea0a57 100644 --- a/js/background.js +++ b/js/background.js @@ -1371,12 +1371,25 @@ }); Whisper.events.on('devicePairingRequestReceivedNoListener', async () => { + // If linking limit has been reached, let master know. + const ourKey = textsecure.storage.user.getNumber(); + const ourPubKey = window.libsession.Types.PubKey.cast(ourKey); + const authorisations = await window.libsession.Protocols.MultiDeviceProtocol.fetchPairingAuthorisations(ourPubKey); + + const title = authorisations.length + ? window.i18n('devicePairingRequestReceivedLimitTitle') + : window.i18n('devicePairingRequestReceivedNoListenerTitle'); + + const description = authorisations.length + ? window.i18n('devicePairingRequestReceivedLimitDescription', window.CONSTANTS.MAX_LINKED_DEVICES) + : window.i18n('devicePairingRequestReceivedNoListenerDescription'); + + const type = authorisations.length ? 'info' : 'warning'; + window.pushToast({ - title: window.i18n('devicePairingRequestReceivedNoListenerTitle'), - description: window.i18n( - 'devicePairingRequestReceivedNoListenerDescription' - ), - type: 'info', + title, + description, + type, id: 'pairingRequestNoListener', shouldFade: false, }); diff --git a/preload.js b/preload.js index 15ad38c5e..e547e4383 100644 --- a/preload.js +++ b/preload.js @@ -82,6 +82,7 @@ window.CONSTANTS = new (function() { this.MAX_USERNAME_LENGTH = 20; this.MAX_GROUP_NAME_LENGTH = 64; this.DEFAULT_PUBLIC_CHAT_URL = appConfig.get('defaultPublicChatServer'); + this.MAX_LINKED_DEVICES = 1; this.MAX_CONNECTION_DURATION = 5000; this.MAX_MESSAGE_BODY_LENGTH = 64 * 1024; // Limited due to the proof-of-work requirement diff --git a/ts/components/session/RegistrationTabs.tsx b/ts/components/session/RegistrationTabs.tsx index db7fdd8da..a024f02fb 100644 --- a/ts/components/session/RegistrationTabs.tsx +++ b/ts/components/session/RegistrationTabs.tsx @@ -418,7 +418,7 @@ export class RegistrationTabs extends React.Component<{}, State> { return (
- {window.i18n('devicePairingHeader')} +
{this.renderEnterSessionID(true)} From 0386259fceacc657c710cc286e7d4c68903dbb74 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 6 Jul 2020 16:06:24 +1000 Subject: [PATCH 2/8] cancelling linked --- _locales/en/messages.json | 22 +++++-- js/background.js | 2 +- stylesheets/_session_signin.scss | 22 ++++++- ts/components/session/RegistrationTabs.tsx | 71 ++++++++++++++++------ 4 files changed, 91 insertions(+), 26 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index a650828b3..cb18d4063 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -222,7 +222,7 @@ "description": "Message shown if the import went wrong; first paragraph" }, "importErrorSecond": { - "message": "If these steps don't work for you, please submit a debug log (View -> Debug Log) so that we can help you get migrated!", + "message": "If these steps don't work for you, please submit a debug log (View 🠖 Debug Log) so that we can help you get migrated!", "description": "Message shown if the import went wrong; second paragraph" }, "importAgain": { @@ -872,7 +872,7 @@ "message": "Device linking request received." }, "devicePairingRequestReceivedNoListenerDescription": { - "message": "Device linking request received but you are not on the device linking screen. \nFirst go to Settings -> Device -> Link New Device." + "message": "Device linking request received but you are not on the device linking screen. \nGo to Settings 🠖 Device 🠖 Link New Device." }, "waitingForDeviceToRegister": { "message": "Waiting for device to register..." @@ -2379,11 +2379,23 @@ "verifyPassword": { "message": "Verify Password" }, - "devicePairingHeader": { - "message": "1. Open Session on your other device.
2. Navigate to the Linked Devices section in your user account screen.
3. Select 'Link a Device' to prepare your other device for pairing
4. Enter your Session ID below to link this device to your Session ID." + "devicePairingHeaderReassure": { + "message": "Linking may take up to one minute to register on your primary device. Please be patient." + }, + "devicePairingHeader_Step1": { + "message": "Open Session on your other device." + }, + "devicePairingHeader_Step2": { + "message": "Navigate to the Devices section in your user account screen." + }, + "devicePairingHeader_Step3": { + "message": "Select Link New Device to prepare your other device for pairing." + }, + "devicePairingHeader_Step4": { + "message": "Enter your Session ID below to link this device to your Session ID." }, "enterSessionIDHere": { - "message": "Enter other device’s Session ID here" + "message": "Enter your Session ID here" }, "continueYourSession": { "message": "Continue Your Session" diff --git a/js/background.js b/js/background.js index 69dea0a57..85b311577 100644 --- a/js/background.js +++ b/js/background.js @@ -1390,7 +1390,7 @@ title, description, type, - id: 'pairingRequestNoListener', + id: 'pairingRequestReceived', shouldFade: false, }); }); diff --git a/stylesheets/_session_signin.scss b/stylesheets/_session_signin.scss index 65f0eed86..d56891c94 100644 --- a/stylesheets/_session_signin.scss +++ b/stylesheets/_session_signin.scss @@ -75,6 +75,20 @@ &__content { width: 100%; padding-top: 20px; + + &__secret-words { + display: flex; + flex-direction: column; + align-items: center; + background-color: $session-shade-6; + padding: $session-margin-sm $session-margin-lg; + border-radius: 8px; + margin-bottom: $session-margin-md; + + label { + margin-bottom: 5px; + } + } } &__sections { @@ -228,11 +242,17 @@ &-description-long, &-signin-device-pairing-header { padding-top: 10px; - padding-bottom: 10px; + padding-bottom: 20px; color: $session-color-light-grey; text-align: center; font-size: 12px; line-height: 20px; + + ol { + margin-left: 20px; + padding: 0px; + text-align: justify; + } } &-id-editable { diff --git a/ts/components/session/RegistrationTabs.tsx b/ts/components/session/RegistrationTabs.tsx index a024f02fb..140e96286 100644 --- a/ts/components/session/RegistrationTabs.tsx +++ b/ts/components/session/RegistrationTabs.tsx @@ -34,6 +34,7 @@ interface State { selectedTab: TabType; signInMode: SignInMode; signUpMode: SignUpMode; + secretWords: string | undefined; displayName: string; password: string; validatePassword: string; @@ -109,6 +110,7 @@ export class RegistrationTabs extends React.Component<{}, State> { selectedTab: TabType.Create, signInMode: SignInMode.Default, signUpMode: SignUpMode.Default, + secretWords: undefined, displayName: '', password: '', validatePassword: '', @@ -418,10 +420,34 @@ export class RegistrationTabs extends React.Component<{}, State> { return (
- + {this.state.loading ? ( +

{window.i18n('devicePairingHeaderReassure')}

+ ) : ( +
    +
  1. + +
  2. +
  3. + +
  4. +
  5. + +
  6. +
  7. + +
  8. +
+ )}
- {this.renderEnterSessionID(true)} - + {this.renderEnterSessionID(!this.state.loading)} + {this.state.secretWords && ( +
+ +
{this.state.secretWords}
+
+ )} + +
); } @@ -582,28 +608,36 @@ export class RegistrationTabs extends React.Component<{}, State> { password, } = this.state; + const shouldRenderCancel = this.state.signInMode === SignInMode.LinkingDevice && this.state.loading && !!this.state.secretWords; + let enableContinue = true; let text = window.i18n('continueYourSession'); - const displayNameOK = !displayNameError && !!displayName; //display name required - const mnemonicOK = !mnemonicError && !!mnemonicSeed; //Mnemonic required + const displayNameOK = !displayNameError && !!displayName; // Display name required + const mnemonicOK = !mnemonicError && !!mnemonicSeed; // Mnemonic required const passwordsOK = !password || (!passwordErrorString && passwordFieldsMatch); // password is valid if empty, or if no error and fields are matching if (signInMode === SignInMode.UsingSeed) { enableContinue = displayNameOK && mnemonicOK && passwordsOK; } else if (signInMode === SignInMode.LinkingDevice) { - enableContinue = !!primaryDevicePubKey; - text = window.i18n('linkDevice'); + enableContinue = true; + text = window.i18n(shouldRenderCancel ? 'cancel' : 'linkDevice'); } else if (signUpMode === SignUpMode.EnterDetails) { enableContinue = displayNameOK && passwordsOK; } + const onClick = () => { + shouldRenderCancel + ? this.cancelSecondaryDevice() + : this.handleContinueYourSessionClick(); + }; + + const buttonColor = shouldRenderCancel ? SessionButtonColor.White : SessionButtonColor.Green; + return ( { - this.handleContinueYourSessionClick(); - }} + onClick={onClick} buttonType={SessionButtonType.Brand} - buttonColor={SessionButtonColor.Green} + buttonColor={buttonColor} text={text} disabled={!enableContinue} /> @@ -719,6 +753,11 @@ export class RegistrationTabs extends React.Component<{}, State> { window.ConversationController.reset(); await window.ConversationController.load(); window.Whisper.RotateSignedPreKeyListener.stop(window.Whisper.events); + + this.setState({ + loading: false, + secretWords: undefined, + }); } private async register(language: string) { @@ -892,14 +931,8 @@ export class RegistrationTabs extends React.Component<{}, State> { await this.accountManager.requestPairing(primaryPubKey); const pubkey = window.textsecure.storage.user.getNumber(); - const words = window.mnemonic.pubkey_to_secret_words(pubkey); - // window.console.log(`Here is your secret:\n${words}`); - window.pushToast({ - title: `${window.i18n('secretPrompt')}`, - description: words, - id: 'yourSecret', - shouldFade: false, - }); + const secretWords = window.mnemonic.pubkey_to_secret_words(pubkey); + this.setState({secretWords}); } catch (e) { window.console.log(e); await this.resetRegistration(); From 235ab0bfb36840d47b125a26d7b02bced8b6612c Mon Sep 17 00:00:00 2001 From: Audric Ackermann Date: Mon, 6 Jul 2020 15:54:30 +1000 Subject: [PATCH 3/8] create convo for both primary and secondary in receivemessage --- js/modules/loki_snode_api.js | 2 +- ts/receiver/dataMessage.ts | 8 +++++--- ts/session/protocols/SessionProtocol.ts | 4 ++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/js/modules/loki_snode_api.js b/js/modules/loki_snode_api.js index d4b2a6cdc..9828ce43a 100644 --- a/js/modules/loki_snode_api.js +++ b/js/modules/loki_snode_api.js @@ -332,7 +332,7 @@ class LokiSnodeAPI { try { const conversation = ConversationController.get(pubKey); if (!conversation) { - throw new Error('Could not find conversation ', pubKey); + throw new Error(`Could not find conversation '${pubKey}'`); } const swarmNodes = [...conversation.get('swarmNodes')]; diff --git a/ts/receiver/dataMessage.ts b/ts/receiver/dataMessage.ts index 653075b37..06116b058 100644 --- a/ts/receiver/dataMessage.ts +++ b/ts/receiver/dataMessage.ts @@ -632,9 +632,11 @@ export async function handleMessageEvent(event: any): Promise { conversationId = primarySource.key; } - // the conversation with the primary device of that source (can be the same as conversationOrigin) - const conversation = window.ConversationController.get(conversationId); - + // be sure to call this one with conversationId. because we might need to create the primary conversation from a message of a secondary device + const conversation = await window.ConversationController.getOrCreateAndWait( + conversationId, + type + ); conversation.queueJob(() => { handleMessageJob( msg, diff --git a/ts/session/protocols/SessionProtocol.ts b/ts/session/protocols/SessionProtocol.ts index 45b3673f6..853bcbf1c 100644 --- a/ts/session/protocols/SessionProtocol.ts +++ b/ts/session/protocols/SessionProtocol.ts @@ -105,6 +105,10 @@ export class SessionProtocol { public static async sendSessionRequestIfNeeded( pubkey: PubKey ): Promise { + const { ConversationController } = window; + // FIXME audric: to remove once swarm nodes are not stored on the conversation itself. + await ConversationController.getOrCreateAndWait(pubkey.key, 'private'); + if ( (await SessionProtocol.hasSession(pubkey)) || (await SessionProtocol.hasSentSessionRequest(pubkey)) From 600653d3d6372f2a5cdedaa19d57894b89137489 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 6 Jul 2020 16:31:33 +1000 Subject: [PATCH 4/8] allow cancel linking --- js/background.js | 11 +++-- stylesheets/_session_signin.scss | 2 +- ts/components/session/RegistrationTabs.tsx | 53 ++++++++++++++-------- ts/state/selectors/conversations.ts | 13 ++++-- 4 files changed, 53 insertions(+), 26 deletions(-) diff --git a/js/background.js b/js/background.js index 85b311577..f342aeab9 100644 --- a/js/background.js +++ b/js/background.js @@ -1373,15 +1373,20 @@ Whisper.events.on('devicePairingRequestReceivedNoListener', async () => { // If linking limit has been reached, let master know. const ourKey = textsecure.storage.user.getNumber(); - const ourPubKey = window.libsession.Types.PubKey.cast(ourKey); - const authorisations = await window.libsession.Protocols.MultiDeviceProtocol.fetchPairingAuthorisations(ourPubKey); + const ourPubKey = window.libsession.Types.PubKey.cast(ourKey); + const authorisations = await window.libsession.Protocols.MultiDeviceProtocol.fetchPairingAuthorisations( + ourPubKey + ); const title = authorisations.length ? window.i18n('devicePairingRequestReceivedLimitTitle') : window.i18n('devicePairingRequestReceivedNoListenerTitle'); const description = authorisations.length - ? window.i18n('devicePairingRequestReceivedLimitDescription', window.CONSTANTS.MAX_LINKED_DEVICES) + ? window.i18n( + 'devicePairingRequestReceivedLimitDescription', + window.CONSTANTS.MAX_LINKED_DEVICES + ) : window.i18n('devicePairingRequestReceivedNoListenerDescription'); const type = authorisations.length ? 'info' : 'warning'; diff --git a/stylesheets/_session_signin.scss b/stylesheets/_session_signin.scss index d56891c94..03ccccc3f 100644 --- a/stylesheets/_session_signin.scss +++ b/stylesheets/_session_signin.scss @@ -83,7 +83,7 @@ background-color: $session-shade-6; padding: $session-margin-sm $session-margin-lg; border-radius: 8px; - margin-bottom: $session-margin-md; + margin-bottom: 0px; label { margin-bottom: 5px; diff --git a/ts/components/session/RegistrationTabs.tsx b/ts/components/session/RegistrationTabs.tsx index 140e96286..c92f5976f 100644 --- a/ts/components/session/RegistrationTabs.tsx +++ b/ts/components/session/RegistrationTabs.tsx @@ -420,21 +420,29 @@ export class RegistrationTabs extends React.Component<{}, State> { return (
- {this.state.loading ? ( + {!!this.state.secretWords ? (

{window.i18n('devicePairingHeaderReassure')}

) : (
  1. - +
  2. - +
  3. - +
  4. - +
)} @@ -446,7 +454,6 @@ export class RegistrationTabs extends React.Component<{}, State> {
{this.state.secretWords}
)} -
); @@ -560,10 +567,14 @@ export class RegistrationTabs extends React.Component<{}, State> { return (
{this.renderContinueYourSessionButton()} -

{or}

- {this.renderRestoreUsingSeedButton( - SessionButtonType.BrandOutline, - SessionButtonColor.White + {!this.state.secretWords && ( + <> +

{or}

+ {this.renderRestoreUsingSeedButton( + SessionButtonType.BrandOutline, + SessionButtonColor.White + )} + )}
); @@ -602,14 +613,11 @@ export class RegistrationTabs extends React.Component<{}, State> { passwordFieldsMatch, displayNameError, mnemonicError, - primaryDevicePubKey, displayName, mnemonicSeed, password, } = this.state; - const shouldRenderCancel = this.state.signInMode === SignInMode.LinkingDevice && this.state.loading && !!this.state.secretWords; - let enableContinue = true; let text = window.i18n('continueYourSession'); const displayNameOK = !displayNameError && !!displayName; // Display name required @@ -620,23 +628,32 @@ export class RegistrationTabs extends React.Component<{}, State> { enableContinue = displayNameOK && mnemonicOK && passwordsOK; } else if (signInMode === SignInMode.LinkingDevice) { enableContinue = true; - text = window.i18n(shouldRenderCancel ? 'cancel' : 'linkDevice'); + text = window.i18n('linkDevice'); } else if (signUpMode === SignUpMode.EnterDetails) { enableContinue = displayNameOK && passwordsOK; } + const shouldRenderCancel = + this.state.signInMode === SignInMode.LinkingDevice && + !!this.state.secretWords; + + text = shouldRenderCancel ? window.i18n('cancel') : text; + const buttonColor = shouldRenderCancel + ? SessionButtonColor.White + : SessionButtonColor.Green; + const buttonType = shouldRenderCancel + ? SessionButtonType.BrandOutline + : SessionButtonType.Brand; const onClick = () => { shouldRenderCancel ? this.cancelSecondaryDevice() : this.handleContinueYourSessionClick(); }; - const buttonColor = shouldRenderCancel ? SessionButtonColor.White : SessionButtonColor.Green; - return ( { await this.accountManager.requestPairing(primaryPubKey); const pubkey = window.textsecure.storage.user.getNumber(); const secretWords = window.mnemonic.pubkey_to_secret_words(pubkey); - this.setState({secretWords}); + this.setState({ secretWords }); } catch (e) { window.console.log(e); await this.resetRegistration(); diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index de93f3d84..af28d4f18 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -120,6 +120,15 @@ export const _getLeftPaneLists = ( }; } + // Remove all invalid conversations and conversatons of devices associated with cancelled attempted links + if (!conversation.timestamp) { + continue; + } + + if (!conversation.activeAt) { + continue; + } + if (conversation.activeAt !== undefined) { allContacts.push(conversation); } @@ -128,10 +137,6 @@ export const _getLeftPaneLists = ( unreadCount += conversation.unreadCount; } - if (!conversation.activeAt) { - continue; - } - if (conversation.isArchived) { archivedConversations.push(conversation); } else { From 2f38a4a7a3584650eb02d04cb7ec4035474ad282 Mon Sep 17 00:00:00 2001 From: Vincent Date: Mon, 6 Jul 2020 18:20:21 +1000 Subject: [PATCH 5/8] revert primary-device-pubkey --- ts/components/session/RegistrationTabs.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ts/components/session/RegistrationTabs.tsx b/ts/components/session/RegistrationTabs.tsx index c92f5976f..e7a07e5e2 100644 --- a/ts/components/session/RegistrationTabs.tsx +++ b/ts/components/session/RegistrationTabs.tsx @@ -613,6 +613,7 @@ export class RegistrationTabs extends React.Component<{}, State> { passwordFieldsMatch, displayNameError, mnemonicError, + primaryDevicePubKey, displayName, mnemonicSeed, password, @@ -627,7 +628,7 @@ export class RegistrationTabs extends React.Component<{}, State> { if (signInMode === SignInMode.UsingSeed) { enableContinue = displayNameOK && mnemonicOK && passwordsOK; } else if (signInMode === SignInMode.LinkingDevice) { - enableContinue = true; + enableContinue = !!primaryDevicePubKey; text = window.i18n('linkDevice'); } else if (signUpMode === SignUpMode.EnterDetails) { enableContinue = displayNameOK && passwordsOK; From 447d2b3406491706546624e71bed28ab0fe83407 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 7 Jul 2020 10:03:04 +1000 Subject: [PATCH 6/8] edit-loading-state --- ts/components/session/RegistrationTabs.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ts/components/session/RegistrationTabs.tsx b/ts/components/session/RegistrationTabs.tsx index e7a07e5e2..be7d733ea 100644 --- a/ts/components/session/RegistrationTabs.tsx +++ b/ts/components/session/RegistrationTabs.tsx @@ -447,7 +447,7 @@ export class RegistrationTabs extends React.Component<{}, State> { )}
- {this.renderEnterSessionID(!this.state.loading)} + {this.renderEnterSessionID(!this.state.secretWords)} {this.state.secretWords && (
From e7569a569cdbb4ab3449ca76b2c60289aba242f0 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 7 Jul 2020 11:56:47 +1000 Subject: [PATCH 7/8] fix-unicode-windows-error --- _locales/en/messages.json | 4 ++-- ts/receiver/dataMessage.ts | 8 +++----- ts/session/protocols/SessionProtocol.ts | 2 -- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/_locales/en/messages.json b/_locales/en/messages.json index cb18d4063..b07b94851 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -222,7 +222,7 @@ "description": "Message shown if the import went wrong; first paragraph" }, "importErrorSecond": { - "message": "If these steps don't work for you, please submit a debug log (View 🠖 Debug Log) so that we can help you get migrated!", + "message": "If these steps don't work for you, please submit a debug log (View -> Debug Log) so that we can help you get migrated!", "description": "Message shown if the import went wrong; second paragraph" }, "importAgain": { @@ -872,7 +872,7 @@ "message": "Device linking request received." }, "devicePairingRequestReceivedNoListenerDescription": { - "message": "Device linking request received but you are not on the device linking screen. \nGo to Settings 🠖 Device 🠖 Link New Device." + "message": "Device linking request received but you are not on the device linking screen. \nGo to Settings > Device > Link New Device." }, "waitingForDeviceToRegister": { "message": "Waiting for device to register..." diff --git a/ts/receiver/dataMessage.ts b/ts/receiver/dataMessage.ts index 06116b058..653075b37 100644 --- a/ts/receiver/dataMessage.ts +++ b/ts/receiver/dataMessage.ts @@ -632,11 +632,9 @@ export async function handleMessageEvent(event: any): Promise { conversationId = primarySource.key; } - // be sure to call this one with conversationId. because we might need to create the primary conversation from a message of a secondary device - const conversation = await window.ConversationController.getOrCreateAndWait( - conversationId, - type - ); + // the conversation with the primary device of that source (can be the same as conversationOrigin) + const conversation = window.ConversationController.get(conversationId); + conversation.queueJob(() => { handleMessageJob( msg, diff --git a/ts/session/protocols/SessionProtocol.ts b/ts/session/protocols/SessionProtocol.ts index 0fe52f915..45b3673f6 100644 --- a/ts/session/protocols/SessionProtocol.ts +++ b/ts/session/protocols/SessionProtocol.ts @@ -105,8 +105,6 @@ export class SessionProtocol { public static async sendSessionRequestIfNeeded( pubkey: PubKey ): Promise { - const { ConversationController } = window; - if ( (await SessionProtocol.hasSession(pubkey)) || (await SessionProtocol.hasSentSessionRequest(pubkey)) From 5b68ea69f72c0f5ceab211a74aef67d174981085 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 7 Jul 2020 13:21:03 +1000 Subject: [PATCH 8/8] revert activeAt position --- ts/state/selectors/conversations.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ts/state/selectors/conversations.ts b/ts/state/selectors/conversations.ts index af28d4f18..5b896ad6c 100644 --- a/ts/state/selectors/conversations.ts +++ b/ts/state/selectors/conversations.ts @@ -125,10 +125,6 @@ export const _getLeftPaneLists = ( continue; } - if (!conversation.activeAt) { - continue; - } - if (conversation.activeAt !== undefined) { allContacts.push(conversation); } @@ -137,6 +133,10 @@ export const _getLeftPaneLists = ( unreadCount += conversation.unreadCount; } + if (!conversation.activeAt) { + continue; + } + if (conversation.isArchived) { archivedConversations.push(conversation); } else {