sforkowany z mirror/soapbox
ChatBox: click lock button to initiate key exchange
rodzic
c65239dd15
commit
e8433a88ab
|
@ -15,6 +15,7 @@ import { Stack, HStack, IconButton } from 'soapbox/components/ui';
|
||||||
import UploadProgress from 'soapbox/features/compose/components/upload-progress';
|
import UploadProgress from 'soapbox/features/compose/components/upload-progress';
|
||||||
import UploadButton from 'soapbox/features/compose/components/upload_button';
|
import UploadButton from 'soapbox/features/compose/components/upload_button';
|
||||||
import { truncateFilename } from 'soapbox/utils/media';
|
import { truncateFilename } from 'soapbox/utils/media';
|
||||||
|
import { initPgpKey } from 'soapbox/utils/pgp';
|
||||||
|
|
||||||
import ChatMessageList from './chat_message_list';
|
import ChatMessageList from './chat_message_list';
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@ const messages = defineMessages({
|
||||||
|
|
||||||
const mapStateToProps = (state, { chatId }) => ({
|
const mapStateToProps = (state, { chatId }) => ({
|
||||||
me: state.get('me'),
|
me: state.get('me'),
|
||||||
|
account: state.getIn(['accounts', state.me]),
|
||||||
chat: state.getIn(['chats', 'items', chatId]),
|
chat: state.getIn(['chats', 'items', chatId]),
|
||||||
chatMessageIds: state.getIn(['chat_message_lists', chatId], ImmutableOrderedSet()),
|
chatMessageIds: state.getIn(['chat_message_lists', chatId], ImmutableOrderedSet()),
|
||||||
});
|
});
|
||||||
|
@ -169,13 +171,24 @@ class ChatBox extends ImmutablePureComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sendPublicKey = async() => {
|
||||||
|
const { dispatch, chatId, account } = this.props;
|
||||||
|
const { publicKey } = await initPgpKey(account.fqn);
|
||||||
|
|
||||||
|
const params = {
|
||||||
|
content: publicKey,
|
||||||
|
};
|
||||||
|
|
||||||
|
dispatch(sendChatMessage(chatId, params));
|
||||||
|
}
|
||||||
|
|
||||||
renderEncryptionButton = () => {
|
renderEncryptionButton = () => {
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
className='text-gray-400 hover:text-gray-600'
|
className='text-gray-400 hover:text-gray-600'
|
||||||
iconClassName='h-5 w-5'
|
iconClassName='h-5 w-5'
|
||||||
src={require('@tabler/icons/icons/lock-open.svg')}
|
src={require('@tabler/icons/icons/lock-open.svg')}
|
||||||
onClick={() => {}}
|
onClick={this.sendPublicKey}
|
||||||
transparent
|
transparent
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
Ładowanie…
Reference in New Issue