Conversation: store lastMessage/lastMessageStatus in memory only

This commit is contained in:
Scott Nonnenberg 2018-07-25 15:02:37 -07:00
parent f39a96bc76
commit 61f7b8360b
8 changed files with 126 additions and 85 deletions

View file

@ -9,6 +9,7 @@ describe('AttachmentView', () => {
before(async () => {
await clearDatabase();
convo = new Whisper.Conversation({ id: 'foo' });
message = convo.messageCollection.add({
conversationId: convo.id,

View file

@ -24,20 +24,26 @@ describe('ConversationSearchView', function() {
});
});
describe('Searching for left groups', function() {
var convo = new Whisper.ConversationCollection().add({
id: 'a-left-group',
name: 'i left this group',
members: [],
type: 'group',
left: true,
});
let convo;
before(() => {
convo = new Whisper.ConversationCollection().add({
id: 'a-left-group',
name: 'i left this group',
members: [],
type: 'group',
left: true,
});
return wrapDeferred(convo.save());
});
describe('with no messages', function() {
var input = $('<input>');
var view = new Whisper.ConversationSearchView({ input: input }).render();
var input;
var view;
before(function(done) {
input = $('<input>');
view = new Whisper.ConversationSearchView({ input: input }).render();
view.$input.val('left');
view.filterContacts();
view.typeahead_view.collection.on('reset', function() {
@ -52,9 +58,11 @@ describe('ConversationSearchView', function() {
});
});
describe('with messages', function() {
var input = $('<input>');
var view = new Whisper.ConversationSearchView({ input: input }).render();
var input;
var view;
before(function(done) {
input = $('<input>');
view = new Whisper.ConversationSearchView({ input: input }).render();
convo.save({ lastMessage: 'asdf' }).then(function() {
view.$input.val('left');
view.filterContacts();
@ -72,17 +80,22 @@ describe('ConversationSearchView', function() {
});
});
describe('Showing all contacts', function() {
var input = $('<input>');
var view = new Whisper.ConversationSearchView({ input: input }).render();
view.showAllContacts = true;
var convo = new Whisper.ConversationCollection().add({
id: 'a-left-group',
name: 'i left this group',
members: [],
type: 'group',
left: true,
});
let input;
let view;
let convo;
before(() => {
input = $('<input>');
view = new Whisper.ConversationSearchView({ input: input }).render();
view.showAllContacts = true;
convo = new Whisper.ConversationCollection().add({
id: 'a-left-group',
name: 'i left this group',
members: [],
type: 'group',
left: true,
});
return wrapDeferred(convo.save());
});
describe('with no messages', function() {

View file

@ -1,11 +1,19 @@
describe('InboxView', function() {
var inboxView = new Whisper.InboxView({
model: {},
window: window,
initialLoadComplete: function() {},
}).render();
let inboxView;
let conversation;
var conversation = new Whisper.Conversation({ id: '1234', type: 'private' });
before(() => {
inboxView = new Whisper.InboxView({
model: {},
window: window,
initialLoadComplete: function() {},
}).render();
conversation = new Whisper.Conversation({
id: '1234',
type: 'private',
});
});
describe('the conversation stack', function() {
it('should be rendered', function() {