Show all contacts all the time

Contacts without conversation identity appear in alphabetical order at
the end of the inbox.

// FREEBIE
This commit is contained in:
lilia 2016-03-17 21:42:03 -07:00
parent b4960b29d8
commit 760bfffb50
5 changed files with 69 additions and 18 deletions

View file

@ -144,6 +144,41 @@
conversations.createIndex('unread', ['conversationId', 'unread'], { unique: false });
next();
}
},
{
version: "9.0",
migrate: function(transaction, next) {
console.log('migration 9.0');
window.addEventListener('storage_ready', function() {
console.log('marking contacts and groups active');
var all = new Whisper.ConversationCollection();
var myNumber = textsecure.storage.user.getNumber();
all.fetch().then(function() {
var inactive = all.filter(function(model) {
return !model.get('active_at') && model.id !== myNumber;
});
inactive.sort(function(m1, m2) {
var title1 = m1.getTitle().toLowerCase();
var title2 = m2.getTitle().toLowerCase();
if (title1 === title2) {
return 0;
}
if (title1 < title2) {
return -1;
}
if (title1 > title2) {
return 1;
}
});
inactive.forEach(function(model) {
if (model.isPrivate() || !model.get('left')) {
model.save({ active_at: 1 });
}
});
});
});
next();
}
}
];
}());