Display the participant panel for guests

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2018-07-26 15:09:04 +02:00 коммит произвёл Daniel Calviño Sánchez
Родитель 881fdd7cc9
Коммит 016dfd9d72
2 изменённых файлов: 29 добавлений и 2 удалений

Просмотреть файл

@ -374,13 +374,15 @@
id: 'participantsTabView' id: 'participantsTabView'
}); });
this.signaling.on('participantListChanged', function() { this._participantsListChangedCallback = function() {
// The "participantListChanged" event can be triggered by the // The "participantListChanged" event can be triggered by the
// signaling before the room is set in the collection. // signaling before the room is set in the collection.
if (this._participants.url) { if (this._participants.url) {
this._participants.fetch(); this._participants.fetch();
} }
}.bind(this)); }.bind(this);
this.signaling.on('participantListChanged', this._participantsListChangedCallback);
this._participantsView.listenTo(this._rooms, 'change:active', function(model, active) { this._participantsView.listenTo(this._rooms, 'change:active', function(model, active) {
if (active) { if (active) {
@ -390,6 +392,15 @@
this._sidebarView.addTab('participants', { label: t('spreed', 'Participants'), icon: 'icon-contacts-dark' }, this._participantsView); this._sidebarView.addTab('participants', { label: t('spreed', 'Participants'), icon: 'icon-contacts-dark' }, this._participantsView);
}, },
_hideParticipantList: function() {
this._sidebarView.removeTab('participants');
this.signaling.off('participantListChanged', this._participantsListChangedCallback);
delete this._participantsListChangedCallback;
delete this._participantsView;
delete this._participants;
},
/** /**
* @param {string} token * @param {string} token
*/ */
@ -667,6 +678,18 @@
// in the public share auth page). // in the public share auth page).
this.activeRoom = new OCA.SpreedMe.Models.Room({ token: this.token }); this.activeRoom = new OCA.SpreedMe.Models.Room({ token: this.token });
this.signaling.setRoom(this.activeRoom); this.signaling.setRoom(this.activeRoom);
this.listenTo(this.activeRoom, 'change:participantType', function(model, participantType) {
if (participantType === OCA.SpreedMe.app.GUEST_MODERATOR) {
this._showParticipantList();
// The public page supports only a single room, so the
// active room has to be explicitly set as it will not
// be set in a 'change:active' event.
this._participantsView.setRoom(this.activeRoom);
} else {
this._hideParticipantList();
}
});
} }
this._registerPageEvents(); this._registerPageEvents();

Просмотреть файл

@ -22,9 +22,13 @@ script(
'models/localstoragemodel', 'models/localstoragemodel',
'models/room', 'models/room',
'models/roomcollection', 'models/roomcollection',
'models/participant',
'models/participantcollection',
'views/callinfoview', 'views/callinfoview',
'views/chatview', 'views/chatview',
'views/editabletextlabel', 'views/editabletextlabel',
'views/participantlistview',
'views/participantview',
'views/roomlistview', 'views/roomlistview',
'views/sidebarview', 'views/sidebarview',
'views/tabview', 'views/tabview',