findOrCreateById instead of private-specific method

Anyway, findOrCreateById with no type didn't succeed, because the
conversation didn't validate.

FREEBIE
This commit is contained in:
Scott Nonnenberg 2017-07-25 10:33:28 -07:00
parent ef3431af1b
commit 3e8b34f3d0
3 changed files with 11 additions and 22 deletions

View file

@ -86,24 +86,10 @@
var conversation = conversations.add(attrs, {merge: true});
return conversation;
},
findOrCreatePrivateById: function(id) {
findOrCreateById: function(id, type) {
var conversation = conversations.add({
id: id,
type: 'private'
});
return new Promise(function(resolve, reject) {
conversation.fetch().then(function() {
resolve(conversation);
}, function() {
conversation.save().then(function() {
resolve(conversation);
}, reject);
});
});
},
findOrCreateById: function(id) {
var conversation = conversations.add({
id: id
type: type
});
return new Promise(function(resolve, reject) {
conversation.fetch().then(function() {