chats now have ids
This commit is contained in:
parent
9a9185f560
commit
e0fe2e96ba
2 changed files with 10 additions and 2 deletions
|
|
@ -586,7 +586,8 @@ const onChats = (cb, gun, user, SEA) => {
|
||||||
recipientAvatar: '',
|
recipientAvatar: '',
|
||||||
recipientDisplayName: Utils.defaultName(recipientPK),
|
recipientDisplayName: Utils.defaultName(recipientPK),
|
||||||
recipientPublicKey: recipientPK,
|
recipientPublicKey: recipientPK,
|
||||||
didDisconnect
|
didDisconnect,
|
||||||
|
id: recipientPK + incomingID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -625,7 +626,8 @@ const onChats = (cb, gun, user, SEA) => {
|
||||||
recipientAvatar: '',
|
recipientAvatar: '',
|
||||||
recipientDisplayName: Utils.defaultName(recipientPK),
|
recipientDisplayName: Utils.defaultName(recipientPK),
|
||||||
recipientPublicKey: recipientPK,
|
recipientPublicKey: recipientPK,
|
||||||
didDisconnect
|
didDisconnect,
|
||||||
|
id: recipientPK + incomingFeedID
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,8 @@ exports.isChatMessage = item => {
|
||||||
* outgoing/incoming feed paradigm. It combines both the outgoing and incoming
|
* outgoing/incoming feed paradigm. It combines both the outgoing and incoming
|
||||||
* messages into one data structure plus metada about the chat.
|
* messages into one data structure plus metada about the chat.
|
||||||
* @typedef {object} Chat
|
* @typedef {object} Chat
|
||||||
|
* @prop {string} id Chats now have IDs because of disconnect.
|
||||||
|
* RecipientPublicKey will no longer be unique.
|
||||||
* @prop {string|null} recipientAvatar Base64 encoded image.
|
* @prop {string|null} recipientAvatar Base64 encoded image.
|
||||||
* @prop {string} recipientPublicKey A way to uniquely identify each chat.
|
* @prop {string} recipientPublicKey A way to uniquely identify each chat.
|
||||||
* @prop {ChatMessage[]} messages Sorted from most recent to least recent.
|
* @prop {ChatMessage[]} messages Sorted from most recent to least recent.
|
||||||
|
|
@ -107,6 +109,10 @@ exports.isChat = item => {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof obj.id !== 'string') {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
return obj.messages.every(msg => exports.isChatMessage(msg))
|
return obj.messages.every(msg => exports.isChatMessage(msg))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue