Check for model in blocked settings

pull/1312/head
Konstantin Ullrich 5 years ago
parent 7fad410777
commit 86f8fe54ae

@ -603,11 +603,15 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
let title: string; let title: string;
const currentModel = window.ConversationController.get(blockedNumber); const currentModel = window.ConversationController.get(blockedNumber);
title = if (currentModel) {
title =
currentModel.getProfileName() || currentModel.getProfileName() ||
currentModel.getName() || currentModel.getName() ||
window.i18n('anonymous'); window.i18n('anonymous');
} else {
title = window.i18n('anonymous');
}
title = `${title} ${window.shortenPubkey(blockedNumber)}`; title = `${title} ${window.shortenPubkey(blockedNumber)}`;
results.push({ results.push({
@ -622,7 +626,11 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
}, },
comparisonValue: undefined, comparisonValue: undefined,
setFn: async () => { setFn: async () => {
await currentModel.unblock(); if (currentModel) {
await currentModel.unblock();
} else {
await BlockedNumberController.unblock(blockedNumber)
}
ToastUtils.push({ ToastUtils.push({
title: window.i18n('unblocked'), title: window.i18n('unblocked'),
id: 'unblocked', id: 'unblocked',

Loading…
Cancel
Save