New MessageController as the single place for in-memory messages

This commit is contained in:
Scott Nonnenberg 2019-03-25 18:10:30 -07:00
parent 274949b247
commit 74cb808763
11 changed files with 169 additions and 105 deletions

View file

@ -1,7 +1,10 @@
/* global Backbone: false */
/* global Whisper: false */
/* global ConversationController: false */
/* global _: false */
/* global
Backbone,
Whisper,
ConversationController,
MessageController,
_
*/
/* eslint-disable more/no-then */
@ -45,10 +48,15 @@
const ids = groups.pluck('id');
ids.push(source);
return messages.find(
const target = messages.find(
item =>
!item.isIncoming() && _.contains(ids, item.get('conversationId'))
);
if (!target) {
return null;
}
return MessageController.register(target.id, target);
},
async onReceipt(receipt) {
try {