Move conversations to SQLCipher
This commit is contained in:
parent
8cd3db0262
commit
cd60bdd08a
31 changed files with 1354 additions and 774 deletions
|
@ -134,24 +134,8 @@
|
|||
this.hideHints();
|
||||
this.new_contact_view.$el.hide();
|
||||
this.$input.val('').focus();
|
||||
if (this.showAllContacts) {
|
||||
// NOTE: Temporarily allow `then` until we convert the entire file
|
||||
// to `async` / `await`:
|
||||
// eslint-disable-next-line more/no-then
|
||||
this.typeahead.fetchAlphabetical().then(() => {
|
||||
if (this.typeahead.length > 0) {
|
||||
this.typeahead_view.collection.reset(
|
||||
this.typeahead.filter(isSearchable)
|
||||
);
|
||||
} else {
|
||||
this.showHints();
|
||||
}
|
||||
});
|
||||
this.trigger('show');
|
||||
} else {
|
||||
this.typeahead_view.collection.reset([]);
|
||||
this.trigger('hide');
|
||||
}
|
||||
this.typeahead_view.collection.reset([]);
|
||||
this.trigger('hide');
|
||||
},
|
||||
|
||||
showHints() {
|
||||
|
|
|
@ -57,32 +57,43 @@
|
|||
avatar: this.model.getAvatar(),
|
||||
};
|
||||
},
|
||||
send() {
|
||||
return this.avatarInput.getThumbnail().then(avatarFile => {
|
||||
const now = Date.now();
|
||||
const attrs = {
|
||||
timestamp: now,
|
||||
active_at: now,
|
||||
name: this.$('.name').val(),
|
||||
members: _.union(
|
||||
this.model.get('members'),
|
||||
this.recipients_view.recipients.pluck('id')
|
||||
),
|
||||
};
|
||||
if (avatarFile) {
|
||||
attrs.avatar = avatarFile;
|
||||
}
|
||||
this.model.set(attrs);
|
||||
const groupUpdate = this.model.changed;
|
||||
this.model.save();
|
||||
async send() {
|
||||
// When we turn this view on again, need to handle avatars in the new way
|
||||
|
||||
if (groupUpdate.avatar) {
|
||||
this.model.trigger('change:avatar');
|
||||
}
|
||||
// const avatarFile = await this.avatarInput.getThumbnail();
|
||||
const now = Date.now();
|
||||
const attrs = {
|
||||
timestamp: now,
|
||||
active_at: now,
|
||||
name: this.$('.name').val(),
|
||||
members: _.union(
|
||||
this.model.get('members'),
|
||||
this.recipients_view.recipients.pluck('id')
|
||||
),
|
||||
};
|
||||
|
||||
this.model.updateGroup(groupUpdate);
|
||||
this.goBack();
|
||||
});
|
||||
// if (avatarFile) {
|
||||
// attrs.avatar = avatarFile;
|
||||
// }
|
||||
|
||||
// Because we're no longer using Backbone-integrated saves, we need to manually
|
||||
// clear the changed fields here so model.changed is accurate.
|
||||
this.model.changed = {};
|
||||
this.model.set(attrs);
|
||||
const groupUpdate = this.model.changed;
|
||||
|
||||
await window.Signal.Data.updateConversation(
|
||||
this.model.id,
|
||||
this.model.attributes,
|
||||
{ Conversation: Whisper.Conversation }
|
||||
);
|
||||
|
||||
if (groupUpdate.avatar) {
|
||||
this.model.trigger('change:avatar');
|
||||
}
|
||||
|
||||
this.model.updateGroup(groupUpdate);
|
||||
this.goBack();
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
|
|
@ -16,8 +16,12 @@
|
|||
database: Whisper.Database,
|
||||
storeName: 'conversations',
|
||||
model: Whisper.Conversation,
|
||||
fetchContacts() {
|
||||
return this.fetch({ reset: true, conditions: { type: 'private' } });
|
||||
async fetchContacts() {
|
||||
const models = window.Signal.Data.getAllPrivateConversations({
|
||||
ConversationCollection: Whisper.ConversationCollection,
|
||||
});
|
||||
|
||||
this.reset(models);
|
||||
},
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue