Disables loading side panels when they are disabled.

Adds some safety checks for disabled contactlist.
This commit is contained in:
damencho 2016-11-02 16:14:36 -05:00
parent 6eb767ba11
commit f6609524ea
3 changed files with 21 additions and 10 deletions

View File

@ -514,7 +514,8 @@ export default {
this.isDesktopSharingEnabled =
JitsiMeetJS.isDesktopSharingEnabled();
APP.UI.ContactList = new ContactList(room);
if (UIUtil.isButtonEnabled('contacts'))
APP.UI.ContactList = new ContactList(room);
// if user didn't give access to mic or camera or doesn't have
// them at all, we disable corresponding toolbar buttons

View File

@ -203,7 +203,8 @@ UI.showChatError = function (err, msg) {
* @param {string} displayName new nickname
*/
UI.changeDisplayName = function (id, displayName) {
UI.ContactList.onDisplayNameChange(id, displayName);
if (UI.ContactList)
UI.ContactList.onDisplayNameChange(id, displayName);
VideoLayout.onDisplayNameChanged(id, displayName);
if (APP.conference.isLocalId(id) || id === 'localVideoContainer') {
@ -249,7 +250,8 @@ UI.setLocalRaisedHandStatus = (raisedHandStatus) => {
UI.initConference = function () {
let id = APP.conference.getMyUserId();
// Add myself to the contact list.
UI.ContactList.addContact(id, true);
if (UI.ContactList)
UI.ContactList.addContact(id, true);
// Update default button states before showing the toolbar
// if local role changes buttons state will be again updated.
@ -559,7 +561,8 @@ UI.addUser = function (user) {
var id = user.getId();
var displayName = user.getDisplayName();
UI.hideRingOverLay();
UI.ContactList.addContact(id);
if (UI.ContactList)
UI.ContactList.addContact(id);
messageHandler.notify(
displayName,'notify.somebody', 'connected', 'notify.connected'
@ -586,7 +589,8 @@ UI.addUser = function (user) {
* @param {string} displayName user nickname
*/
UI.removeUser = function (id, displayName) {
UI.ContactList.removeContact(id);
if (UI.ContactList)
UI.ContactList.removeContact(id);
messageHandler.notify(
displayName,'notify.somebody', 'disconnected', 'notify.disconnected'
@ -838,7 +842,8 @@ UI.dockToolbar = function (isDock) {
*/
function changeAvatar(id, avatarUrl) {
VideoLayout.changeUserAvatar(id, avatarUrl);
UI.ContactList.changeUserAvatar(id, avatarUrl);
if (UI.ContactList)
UI.ContactList.changeUserAvatar(id, avatarUrl);
if (APP.conference.isLocalId(id)) {
Profile.changeAvatar(avatarUrl);
}

View File

@ -2,17 +2,22 @@ import Chat from './chat/Chat';
import SettingsMenu from './settings/SettingsMenu';
import Profile from './profile/Profile';
import ContactListView from './contactlist/ContactListView';
import UIUtil from '../util/UIUtil';
const SidePanels = {
init (eventEmitter) {
//Initialize chat
Chat.init(eventEmitter);
if (UIUtil.isButtonEnabled('chat'))
Chat.init(eventEmitter);
//Initialize settings
SettingsMenu.init(eventEmitter);
if (UIUtil.isButtonEnabled('settings'))
SettingsMenu.init(eventEmitter);
//Initialize profile
Profile.init(eventEmitter);
if (UIUtil.isButtonEnabled('profile'))
Profile.init(eventEmitter);
//Initialize contact list view
ContactListView.init();
if (UIUtil.isButtonEnabled('contacts'))
ContactListView.init();
}
};