Recieve chat messages from unknown contacts#32
Recieve chat messages from unknown contacts#32karthik-ir wants to merge 4 commits intoMichaelMure:masterfrom
Conversation
app/actions/contact.js
Outdated
| } | ||
| } | ||
|
|
||
| export function forceFetchProfile(pubkey,getState){ |
There was a problem hiding this comment.
you don't need to pass the getState function like this, redux-thunk provide it for you already. In the line below, just add the getState argument like this:
return async function (dispatch, getState) {
app/actions/contact.js
Outdated
| export function forceFetchProfile(pubkey,getState){ | ||
| return async function (dispatch) { | ||
| const contactList: ContactList = getState().contactList | ||
| var cont = contactList.findContact(pubkey) |
There was a problem hiding this comment.
use the flow typing as much as you can, and let/const :
const contact : ?Contact = contactList.findContact(pubkey)| console.log(data) | ||
|
|
||
| const contact: Contact = Contact.fromProfileData(pubkey, data) | ||
| await dispatch(contactListAction.priv.storeContactInDirectory(contact)) |
There was a problem hiding this comment.
it's not really obvious, but storeContactInDirectory will already store the contact properly in the directory AND the pool, so no need to call storeContactInPool just after
| dispatch(priv.chatReceived(contact, id, message)) | ||
| dispatch(sendChatAck(contact, id)) | ||
|
|
||
| var contact = dispatch(forceFetchProfile(from,getState)).then(function (cont) { |
There was a problem hiding this comment.
use async await instead of chaining the promise with .then(). otherwise my brain melt :(
There was a problem hiding this comment.
I get Actions must be plain objects. Use custom middleware for async actions. If i use that way. No idea why.
No description provided.