From 86f8fe54ae7c7dea4cfb28b607efc2a662509d7f Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Sat, 15 Aug 2020 13:21:35 +0200 Subject: [PATCH 1/3] Check for model in blocked settings --- ts/components/session/settings/SessionSettings.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 043dcd6dd..f98269898 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -603,11 +603,15 @@ export class SettingsView extends React.Component { let title: string; const currentModel = window.ConversationController.get(blockedNumber); - title = + if (currentModel) { + title = currentModel.getProfileName() || currentModel.getName() || window.i18n('anonymous'); - + } else { + title = window.i18n('anonymous'); + } + title = `${title} ${window.shortenPubkey(blockedNumber)}`; results.push({ @@ -622,7 +626,11 @@ export class SettingsView extends React.Component { }, comparisonValue: undefined, setFn: async () => { - await currentModel.unblock(); + if (currentModel) { + await currentModel.unblock(); + } else { + await BlockedNumberController.unblock(blockedNumber) + } ToastUtils.push({ title: window.i18n('unblocked'), id: 'unblocked', From 2f35d9d2a64fc17ddb2694963add06a11b75a9c5 Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Sat, 15 Aug 2020 13:58:24 +0200 Subject: [PATCH 2/3] lint fix --- ts/components/session/settings/SessionSettings.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index f98269898..41dc10d82 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -605,13 +605,13 @@ export class SettingsView extends React.Component { const currentModel = window.ConversationController.get(blockedNumber); if (currentModel) { title = - currentModel.getProfileName() || - currentModel.getName() || - window.i18n('anonymous'); + currentModel.getProfileName() || + currentModel.getName() || + window.i18n('anonymous'); } else { title = window.i18n('anonymous'); } - + title = `${title} ${window.shortenPubkey(blockedNumber)}`; results.push({ @@ -629,7 +629,7 @@ export class SettingsView extends React.Component { if (currentModel) { await currentModel.unblock(); } else { - await BlockedNumberController.unblock(blockedNumber) + await BlockedNumberController.unblock(blockedNumber); } ToastUtils.push({ title: window.i18n('unblocked'), From 5b7c58c0d47d1cc2bf3e47fdb214b895ad53482f Mon Sep 17 00:00:00 2001 From: Konstantin Ullrich Date: Mon, 17 Aug 2020 06:57:28 +0200 Subject: [PATCH 3/3] Refresh after unblocking a SessionID without model --- ts/components/session/settings/SessionSettings.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/ts/components/session/settings/SessionSettings.tsx b/ts/components/session/settings/SessionSettings.tsx index 41dc10d82..66cad1767 100644 --- a/ts/components/session/settings/SessionSettings.tsx +++ b/ts/components/session/settings/SessionSettings.tsx @@ -630,6 +630,7 @@ export class SettingsView extends React.Component { await currentModel.unblock(); } else { await BlockedNumberController.unblock(blockedNumber); + this.forceUpdate(); } ToastUtils.push({ title: window.i18n('unblocked'),