From 9364cee57850dc1a22ffd206074175efa54762df Mon Sep 17 00:00:00 2001 From: lilia Date: Wed, 12 Nov 2014 21:46:57 -0800 Subject: [PATCH] Misc cleanup threads --- js/models/threads.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/js/models/threads.js b/js/models/threads.js index a38ae5c3..63967023 100644 --- a/js/models/threads.js +++ b/js/models/threads.js @@ -1,8 +1,10 @@ // vim: ts=2:sw=2:expandtab: -var Whisper = Whisper || {}; (function () { 'use strict'; + + window.Whisper = window.Whisper || {}; + function encodeAttachments (attachments) { return Promise.all(attachments.map(function(a) { return new Promise(function(resolve, reject) { @@ -21,7 +23,7 @@ var Whisper = Whisper || {}; var Thread = Backbone.Model.extend({ defaults: function() { return { - name: 'New Group', + name: 'New Conversation', image: '/images/default.png', unreadCount: 0, timestamp: new Date().getTime(), @@ -114,9 +116,10 @@ var Whisper = Whisper || {}; }; var thread = this.findOrCreate(attributes); return textsecure.messaging.createGroup(recipients, name).then(function(groupId) { - thread.set('id', getString(groupId)); - thread.set('groupId', getString(groupId)); - thread.save(); + thread.save({ + id : getString(groupId), + groupId : getString(groupId) + }); return thread; }); },