New MessageController as the single place for in-memory messages
This commit is contained in:
parent
274949b247
commit
74cb808763
11 changed files with 169 additions and 105 deletions
|
@ -1,4 +1,11 @@
|
|||
/* global Whisper, Backbone, _, ConversationController, window */
|
||||
/* global
|
||||
Whisper,
|
||||
Backbone,
|
||||
_,
|
||||
ConversationController,
|
||||
MessageController,
|
||||
window
|
||||
*/
|
||||
|
||||
/* eslint-disable more/no-then */
|
||||
|
||||
|
@ -46,9 +53,14 @@
|
|||
const ids = groups.pluck('id');
|
||||
ids.push(reader);
|
||||
|
||||
return messages.find(
|
||||
const target = messages.find(
|
||||
item => item.isOutgoing() && _.contains(ids, item.get('conversationId'))
|
||||
);
|
||||
if (!target) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return MessageController.register(target.id, target);
|
||||
},
|
||||
async onReceipt(receipt) {
|
||||
try {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue