Move to centralized message/cache data layer

Also, ensure that conversation.messageCollection has nothing in it
unless it has an associated ConversationView.
This commit is contained in:
Scott Nonnenberg 2018-07-25 15:02:27 -07:00
parent 34231168a7
commit f39a96bc76
21 changed files with 1119 additions and 993 deletions

View file

@ -83,17 +83,19 @@
describe('Conversation', function() {
var attributes = { type: 'private', id: '+18085555555' };
before(function(done) {
before(async () => {
var convo = new Whisper.ConversationCollection().add(attributes);
convo.save().then(function() {
var message = convo.messageCollection.add({
body: 'hello world',
conversationId: convo.id,
type: 'outgoing',
sent_at: Date.now(),
received_at: Date.now(),
});
message.save().then(done);
await wrapDeferred(convo.save());
var message = convo.messageCollection.add({
body: 'hello world',
conversationId: convo.id,
type: 'outgoing',
sent_at: Date.now(),
received_at: Date.now(),
});
await window.Signal.Data.saveMessage(message.attributes, {
Message: Whisper.Message,
});
});
after(clearDatabase);