feat: override email, display name and avatar on mobile

Will override email, display name and avatar URL with the values
provided in 'context.user' structure of the JWT token.

Settings will no longer be used to retrieve local display name,
email and avatar URL. Now those values will be obtained from
the /features/base/participants Redux state.

fix(jwt/middleware): use const for default name

fix: wrong default display name on web

ref(base/participants): remove getDisplayName functions

ref(jwt): do not accept unknown user fields
This commit is contained in:
paweldomas
2017-10-06 12:52:23 -05:00
committed by Lyubo Marinov
parent 0eddef4d62
commit 8a4e6a7ec0
12 changed files with 237 additions and 101 deletions

View File

@@ -19,7 +19,6 @@ import VideoLayout from "./videolayout/VideoLayout";
import Filmstrip from "./videolayout/Filmstrip";
import SettingsMenu from "./side_pannels/settings/SettingsMenu";
import Profile from "./side_pannels/profile/Profile";
import Settings from "./../settings/Settings";
import { updateDeviceList } from '../../react/features/base/devices';
import { JitsiTrackErrors } from '../../react/features/base/lib-jitsi-meet';
@@ -42,6 +41,7 @@ import {
maybeShowNotificationWithDoNotDisplay,
setNotificationsEnabled
} from '../../react/features/notifications';
import { getLocalParticipant } from '../../react/features/base/participants';
var EventEmitter = require("events");
UI.messageHandler = messageHandler;
@@ -199,7 +199,8 @@ UI.setLocalRaisedHandStatus
* Initialize conference UI.
*/
UI.initConference = function () {
let id = APP.conference.getMyUserId();
const { id, avatarID, email, name }
= getLocalParticipant(APP.store.getState());
// Update default button states before showing the toolbar
// if local role changes buttons state will be again updated.
@@ -207,18 +208,17 @@ UI.initConference = function () {
UI.showToolbar();
let displayName = config.displayJids ? id : Settings.getDisplayName();
let displayName = config.displayJids ? id : name;
if (displayName) {
UI.changeDisplayName('localVideoContainer', displayName);
}
// Make sure we configure our avatar id, before creating avatar for us
let email = Settings.getEmail();
if (email) {
UI.setUserEmail(id, email);
} else {
UI.setUserAvatarID(id, Settings.getAvatarId());
UI.setUserAvatarID(id, avatarID);
}
APP.store.dispatch(checkAutoEnableDesktopSharing());
@@ -235,7 +235,9 @@ UI.mucJoined = function () {
// Update local video now that a conference is joined a user ID should be
// set.
UI.changeDisplayName('localVideoContainer', APP.settings.getDisplayName());
UI.changeDisplayName(
'localVideoContainer',
APP.conference.getLocalDisplayName());
};
/***

View File

@@ -187,7 +187,7 @@ var Chat = {
*/
init (eventEmitter) {
initHTML();
if (APP.settings.getDisplayName()) {
if (APP.conference.getLocalDisplayName()) {
Chat.setChatConversationMode(true);
}
@@ -244,7 +244,7 @@ var Chat = {
// if we are in conversation mode focus on the text input
// if we are not, focus on the display name input
if (APP.settings.getDisplayName())
if (APP.conference.getLocalDisplayName())
deferredFocus('usermsg');
else
deferredFocus('nickinput');