07a0463b65
When deleting all messages in a conversation, the entry in the left pane should be inserted into the alphabetical portion of the list. To keep it in this collection, do not nullify active_at. To ensure the list view is keeping itself correctly sorted, make sure that resorting behavior is triggered any time a relevant attribute is changed. This fixes deleted conversations jumping to the top of the list, and conversation order scrambling when getting a group or contact sync message from our master device. Fixes #734 // FREEBIE
24 lines
760 B
JavaScript
24 lines
760 B
JavaScript
/*
|
|
* vim: ts=4:sw=4:expandtab
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
window.Whisper = window.Whisper || {};
|
|
|
|
Whisper.ConversationListView = Whisper.ListView.extend({
|
|
tagName: 'div',
|
|
itemView: Whisper.ConversationListItemView,
|
|
sort: function(conversation) {
|
|
console.log('sorting conversation', conversation.id);
|
|
var $el = this.$('.' + conversation.cid);
|
|
if ($el && $el.length > 0) {
|
|
var index = getInboxCollection().indexOf(conversation);
|
|
if (index > 0) {
|
|
$el.insertBefore(this.$('.conversation-list-item')[index+1]);
|
|
} else {
|
|
this.$el.prepend($el);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
})();
|