Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Commit

Permalink
Merge pull request #68 from ZbayApp/fix/sending-messages-from-popover
Browse files Browse the repository at this point in the history
fix/sending-messages-from-popover
  • Loading branch information
jkdev601 authored Sep 25, 2020
2 parents 7ed7eca + 0017f2c commit 0522195
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
19 changes: 13 additions & 6 deletions src/renderer/components/widgets/channels/SendMessagePopover.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@ export const SendMessagePopover = ({
anchorEl,
handleClose,
isUnregistered,
createContact,
history
createNewContact,
history,
users
}) => {
const open = Boolean(anchorEl)
const id = open ? 'simple-popover' : undefined
const registeredUsername = users
.toList()
.filter(obj => obj.get('address') === address)
.first()
return (
<Popover
className={classes.popover}
Expand All @@ -44,15 +49,17 @@ export const SendMessagePopover = ({
warrning={
isUnregistered ? 'Unregistered users cannot receive messages.' : null
}
onClick={() =>
createContact({
onClick={() => {
createNewContact({
contact: {
replyTo: address,
username
address,
nickname: username,
publicKey: registeredUsername ? registeredUsername.get('publicKey') : null
},
history
})
}
}
>
<Jdenticon size='100' value={username} />
</QuickActionLayout>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ import * as R from 'ramda'

import SendMessagePopover from '../../../components/widgets/channels/SendMessagePopover'
import identitySelectors from '../../../store/selectors/identity'
import contactsHandlers from '../../../store/handlers/contacts'
import userSelectors from '../../../store/selectors/users'
import directMessages from '../../../store/handlers/contacts'

export const mapStateToProps = state => ({
identityId: identitySelectors.id(state)
identityId: identitySelectors.id(state),
users: userSelectors.users(state)
})

export const mapDispatchToProps = (dispatch) =>
bindActionCreators(
{
createContact: contactsHandlers.epics.createVaultContact
createNewContact: (contact) => directMessages.epics.createVaultContact(contact)
},
dispatch
)
Expand Down

0 comments on commit 0522195

Please sign in to comment.