Skip to content

Commit

Permalink
Eliminate some conversation fields which are no longer used
Browse files Browse the repository at this point in the history
  • Loading branch information
scottnonnenberg-signal committed Nov 2, 2018
1 parent e08c5e3 commit 0297279
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions js/models/conversations.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@
this.unset('unidentifiedDelivery');
this.unset('unidentifiedDeliveryUnrestricted');
this.unset('hasFetchedProfile');
this.unset('tokens');
this.unset('lastMessage');
this.unset('lastMessageStatus');
},

isMe() {
Expand Down Expand Up @@ -956,8 +959,8 @@

let hasChanged = false;
const { lastMessage, lastMessageStatus } = lastMessageUpdate;
lastMessageUpdate.lastMessage = null;
lastMessageUpdate.lastMessageStatus = null;
delete lastMessageUpdate.lastMessage;
delete lastMessageUpdate.lastMessageStatus;

hasChanged = hasChanged || lastMessage !== this.lastMessage;
this.lastMessage = lastMessage;
Expand Down Expand Up @@ -1076,7 +1079,7 @@
},

isSearchable() {
return !this.get('left') || !!this.get('lastMessage');
return !this.get('left');
},

async endSession() {
Expand Down
2 changes: 1 addition & 1 deletion test/views/conversation_search_view_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('ConversationSearchView', function() {
before(async function() {
input = $('<input>');
view = new Whisper.ConversationSearchView({ input: input }).render();
convo.set({ id: '2-search-view', lastMessage: 'asdf' });
convo.set({ id: '2-search-view', left: false });

await window.Signal.Data.saveConversation(convo.attributes, {
Conversation: Whisper.Conversation,
Expand Down

0 comments on commit 0297279

Please sign in to comment.