mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-26 21:28:40 +00:00
Refactor for less model duplication
This commit is contained in:
@@ -163,6 +163,7 @@
|
||||
},
|
||||
|
||||
fetchMessages: function() {
|
||||
if(!this.id) { return false; }
|
||||
return this.messageCollection.fetchConversation(this.id);
|
||||
},
|
||||
|
||||
@@ -181,6 +182,11 @@
|
||||
}
|
||||
},
|
||||
|
||||
reload: function() {
|
||||
this.fetch().then(this.fetchContacts.bind(this));
|
||||
this.fetchMessages();
|
||||
},
|
||||
|
||||
archive: function() {
|
||||
this.set({active_at: null});
|
||||
},
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
if (dataMessage.group) {
|
||||
conversationId = dataMessage.group.id;
|
||||
}
|
||||
var conversation = new Whisper.Conversation({id: conversationId});
|
||||
var conversation = ConversationController.create({id: conversationId});
|
||||
conversation.fetch().always(function() {
|
||||
var now = new Date().getTime();
|
||||
var attributes = { type: 'private' };
|
||||
@@ -218,6 +218,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
conversation.messageCollection.add(message);
|
||||
conversation.save().then(function() {
|
||||
message.save().then(function() {
|
||||
updateInbox();
|
||||
|
||||
Reference in New Issue
Block a user