Delay conversation creation til post-decrypt
This commit is contained in:
@@ -53,13 +53,7 @@
|
||||
var now = new Date().getTime();
|
||||
var timestamp = pushMessage.timestamp.toNumber();
|
||||
|
||||
var conversation = getConversation({
|
||||
id : pushMessage.source,
|
||||
type : 'private'
|
||||
});
|
||||
|
||||
conversation.fetch().always(function() {
|
||||
var message = conversation.messageCollection.add({
|
||||
var message = new Whisper.Message({
|
||||
source : pushMessage.source,
|
||||
sourceDevice : pushMessage.sourceDevice,
|
||||
relay : pushMessage.relay,
|
||||
@@ -73,7 +67,6 @@
|
||||
storage.put("unreadCount", newUnreadCount);
|
||||
extension.navigator.setBadgeText(newUnreadCount);
|
||||
|
||||
conversation.save().then(function() {
|
||||
message.save().then(function() {
|
||||
return new Promise(function(resolve) {
|
||||
resolve(textsecure.protocol_wrapper.handleIncomingPushMessageProto(pushMessage).then(
|
||||
@@ -98,8 +91,6 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// lazy hack
|
||||
|
@@ -17,7 +17,7 @@
|
||||
'use strict';
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
var Message = Backbone.Model.extend({
|
||||
var Message = window.Whisper.Message = Backbone.Model.extend({
|
||||
database : Whisper.Database,
|
||||
storeName : 'messages',
|
||||
defaults : function() {
|
||||
|
Reference in New Issue
Block a user