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,6 +514,7 @@ export default {
this.isDesktopSharingEnabled =
JitsiMeetJS.isDesktopSharingEnabled();
if (UIUtil.isButtonEnabled('contacts'))
APP.UI.ContactList = new ContactList(room);
// if user didn't give access to mic or camera or doesn't have

View File

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

View File

@ -2,16 +2,21 @@ 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
if (UIUtil.isButtonEnabled('chat'))
Chat.init(eventEmitter);
//Initialize settings
if (UIUtil.isButtonEnabled('settings'))
SettingsMenu.init(eventEmitter);
//Initialize profile
if (UIUtil.isButtonEnabled('profile'))
Profile.init(eventEmitter);
//Initialize contact list view
if (UIUtil.isButtonEnabled('contacts'))
ContactListView.init();
}
};