mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
28c7445dce
* refactor most of the components to outside of their Session folder * finish moving overlay and memberListItem to react hook * fix bug with kicked member len >2 not being displayed also sort admins first in UpdateGroupMembers dialog * fix admin leaving text of groupNotification * add a useFocusMount hook to focus input fields on mount * make click avatar convo item open only user dialog * cleanup config default.json * make sure to use convoController to build sync message * disable showing pubkey on opengroups * add a pause on audio playback Fixes #2079
47 lines
1.5 KiB
TypeScript
47 lines
1.5 KiB
TypeScript
import React from 'react';
|
|
import { useSelector } from 'react-redux';
|
|
import { unblockConvoById } from '../../interactions/conversationInteractions';
|
|
import { getConversationController } from '../../session/conversations';
|
|
import { getBlockedPubkeys } from '../../state/selectors/conversations';
|
|
import { SessionButtonColor } from '../basic/SessionButton';
|
|
|
|
import { SessionSettingButtonItem, SessionSettingsItemWrapper } from './SessionSettingListItem';
|
|
|
|
export const BlockedUserSettings = () => {
|
|
const blockedNumbers = useSelector(getBlockedPubkeys);
|
|
|
|
if (!blockedNumbers || blockedNumbers.length === 0) {
|
|
return (
|
|
<SessionSettingsItemWrapper
|
|
inline={true}
|
|
description={window.i18n('noBlockedContacts')}
|
|
title={''}
|
|
>
|
|
{' '}
|
|
</SessionSettingsItemWrapper>
|
|
);
|
|
}
|
|
const blockedEntries = blockedNumbers.map(blockedEntry => {
|
|
const currentModel = getConversationController().get(blockedEntry);
|
|
let title: string;
|
|
|
|
if (currentModel) {
|
|
title = currentModel.getProfileName() || currentModel.getName() || window.i18n('anonymous');
|
|
} else {
|
|
title = window.i18n('anonymous');
|
|
}
|
|
return (
|
|
<SessionSettingButtonItem
|
|
key={blockedEntry}
|
|
buttonColor={SessionButtonColor.Danger}
|
|
buttonText={window.i18n('unblockUser')}
|
|
title={title}
|
|
onClick={async () => {
|
|
await unblockConvoById(blockedEntry);
|
|
}}
|
|
/>
|
|
);
|
|
});
|
|
|
|
return <>{blockedEntries}</>;
|
|
};
|