Commit ce7c5efc262f7bd3901c259fa0988c5da87169a9

Authored by Rodrigo Souto
1 parent d45f8eba

Sort conversations by most recent after roster

Showing 1 changed file with 2 additions and 4 deletions   Show diff stats
public/javascripts/chat.js
... ... @@ -231,6 +231,7 @@ jQuery(function($) {
231 231 var jid_id = Jabber.jid_to_id(jid);
232 232 Jabber.insert_or_update_contact(jid, name);
233 233 });
  234 + sort_conversations();
234 235 // set up presence handler and send initial presence
235 236 Jabber.connection.addHandler(Jabber.on_presence, null, "presence");
236 237 Jabber.send_availability_status(Jabber.presence_status);
... ... @@ -615,22 +616,19 @@ jQuery(function($) {
615 616 Jabber.show_message(jid, from['name'], body, who, from['id'], date, offset);
616 617 });
617 618 stop_fetching('.history');
618   - console.log('Done fetching...');
619 619 ensure_scroll(jid, offset);
620 620 });
621 621 }
622 622  
623 623 function move_conversation_to_the_top(jid) {
624 624 id = Jabber.jid_to_id(jid);
625   - console.log('Moving ' + id);
626   - console.log(id);
627 625 var link = $('#'+id);
628 626 var li = link.closest('li');
629 627 var ul = link.closest('ul');
630 628 ul.prepend(li);
631 629 }
632 630  
633   - function recent_conversations() {
  631 + function sort_conversations() {
634 632 $.getJSON('/chat/recent_conversations', {}, function(data) {
635 633 $.each(data['order'], function(i, identifier) {
636 634 move_conversation_to_the_top(identifier+'-'+data['domain']);
... ...