Misc cleanup threads
This commit is contained in:
parent
b9859ad9d4
commit
9364cee578
1 changed files with 8 additions and 5 deletions
|
@ -1,8 +1,10 @@
|
||||||
// vim: ts=2:sw=2:expandtab:
|
// vim: ts=2:sw=2:expandtab:
|
||||||
var Whisper = Whisper || {};
|
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
window.Whisper = window.Whisper || {};
|
||||||
|
|
||||||
function encodeAttachments (attachments) {
|
function encodeAttachments (attachments) {
|
||||||
return Promise.all(attachments.map(function(a) {
|
return Promise.all(attachments.map(function(a) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
|
@ -21,7 +23,7 @@ var Whisper = Whisper || {};
|
||||||
var Thread = Backbone.Model.extend({
|
var Thread = Backbone.Model.extend({
|
||||||
defaults: function() {
|
defaults: function() {
|
||||||
return {
|
return {
|
||||||
name: 'New Group',
|
name: 'New Conversation',
|
||||||
image: '/images/default.png',
|
image: '/images/default.png',
|
||||||
unreadCount: 0,
|
unreadCount: 0,
|
||||||
timestamp: new Date().getTime(),
|
timestamp: new Date().getTime(),
|
||||||
|
@ -114,9 +116,10 @@ var Whisper = Whisper || {};
|
||||||
};
|
};
|
||||||
var thread = this.findOrCreate(attributes);
|
var thread = this.findOrCreate(attributes);
|
||||||
return textsecure.messaging.createGroup(recipients, name).then(function(groupId) {
|
return textsecure.messaging.createGroup(recipients, name).then(function(groupId) {
|
||||||
thread.set('id', getString(groupId));
|
thread.save({
|
||||||
thread.set('groupId', getString(groupId));
|
id : getString(groupId),
|
||||||
thread.save();
|
groupId : getString(groupId)
|
||||||
|
});
|
||||||
return thread;
|
return thread;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue