From f33897abe2d20199128ef5f32247d2707297095a Mon Sep 17 00:00:00 2001 From: Mikunj Date: Mon, 6 Jul 2020 10:38:04 +1000 Subject: [PATCH] Automatically restore session on no record error --- ts/receiver/errors.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/ts/receiver/errors.ts b/ts/receiver/errors.ts index b3c6818d6..a41179f85 100644 --- a/ts/receiver/errors.ts +++ b/ts/receiver/errors.ts @@ -1,5 +1,7 @@ import { initIncomingMessage } from './dataMessage'; import { toNumber } from 'lodash'; +import { SessionProtocol } from '../session/protocols'; +import { PubKey } from '../session/types'; async function onNoSession(ev: any) { const { ConversationController, Whisper } = window; @@ -18,14 +20,7 @@ async function onNoSession(ev: any) { Conversation: Whisper.Conversation, }); - window.Whisper.events.trigger('showSessionRestoreConfirmation', { - pubkey, - onOk: () => { - convo.sendMessage('', null, null, null, null, { - sessionRestoration: true, - }); - }, - }); + await SessionProtocol.sendSessionRequestIfNeeded(new PubKey(pubkey)); } else { window.log.debug(`Already seen session restore for pubkey: ${pubkey}`); if (ev.confirm) {