Add Subscreen for blocked Users

pull/1297/head
Konstantin Ullrich 5 years ago
parent 323a1498f6
commit 7de0a0ae65

@ -212,6 +212,11 @@ export class LeftPaneSettingSection extends React.Component<Props, State> {
title: window.i18n('privacySettingsTitle'),
hidden: false,
},
{
id: SessionSettingCategory.Blocked,
title: window.i18n('settingsUnblockHeader'),
hidden: isSecondaryDevice,
},
{
id: SessionSettingCategory.Permissions,
title: window.i18n('permissionSettingsTitle'),

@ -103,6 +103,9 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
if (category === SessionSettingCategory.Devices) {
// special case for linked devices
settings = this.getLinkedDeviceSettings();
} else if(category === SessionSettingCategory.Blocked) {
// special case for blocked user
settings = this.getBlockedUserSettings();
} else {
// Grab initial values from database on startup
// ID corresponds to installGetter parameters in preload.js
@ -589,6 +592,44 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
];
}
private getBlockedUserSettings(): Array<LocalSettingType> {
const results: Array<LocalSettingType> = [];
const model = window.getConversations();
for (const currentModel of model.models) {
let displayName = currentModel.id;
if (currentModel.attributes.profile && currentModel.attributes.profile.displayName) {
displayName = currentModel.attributes.profile.displayName
}
if(currentModel.isBlocked()) {
results.push({
id: currentModel.id,
title: displayName,
description: currentModel.id,
type: SessionSettingType.Button,
category: SessionSettingCategory.Blocked,
content: {
buttonColor: SessionButtonColor.Danger,
buttonText: window.i18n('unblockUser'),
},
comparisonValue: undefined,
setFn: () => {
currentModel.unblock()
},
hidden: false,
onClick: undefined,
confirmationDialogParams: undefined,
});
}
}
console.log(results);
return results;
}
private getLinkedDeviceSettings(): Array<LocalSettingType> {
const { linkedPubKeys } = this.state;
const { isSecondaryDevice } = this.props;

Loading…
Cancel
Save