diff --git a/js/models/participantcollection.js b/js/models/participantcollection.js index 5968d9001..ccad1bd6e 100644 --- a/js/models/participantcollection.js +++ b/js/models/participantcollection.js @@ -35,8 +35,20 @@ * @returns {Array} */ setRoom: function(room) { + this.stopListening(this.room, 'change:participants'); + this.stopListening(this.room, 'change:guestList'); + this.room = room; this.url = OC.linkToOCS('apps/spreed/api/v1/room', 2) + this.room.get('token') + '/participants'; + + this.fetch(); + + this.listenTo(this.room, 'change:participants', function() { + this.fetch(); + }); + this.listenTo(this.room, 'change:guestList', function() { + this.fetch(); + }); }, /** diff --git a/js/views/roomlistview.js b/js/views/roomlistview.js index 308683e02..b1d38e527 100644 --- a/js/views/roomlistview.js +++ b/js/views/roomlistview.js @@ -185,7 +185,6 @@ $sidebar.find('.room-name').text(this.model.get('displayName')); OCA.SpreedMe.app._participants.setRoom(this.model); - OCA.SpreedMe.app._participants.fetch(); if (!$content.hasClass('with-app-sidebar')) { $content.addClass('with-app-sidebar');