Fixed display name.
This commit is contained in:
@@ -418,6 +418,9 @@ export default class RoomClient
|
||||
{
|
||||
logger.debug('changeDisplayName() [displayName:"%s"]', displayName);
|
||||
|
||||
if (!displayName)
|
||||
displayName = 'Guest';
|
||||
|
||||
try
|
||||
{
|
||||
await this.sendRequest('changeDisplayName', { displayName });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import { withRoomContext } from '../RoomContext';
|
||||
@@ -158,7 +158,7 @@ JoinDialog.propTypes =
|
||||
{
|
||||
roomClient : PropTypes.any.isRequired,
|
||||
displayName : PropTypes.string.isRequired,
|
||||
loginEnabled : PropTypes.string.isRequired,
|
||||
loginEnabled : PropTypes.bool.isRequired,
|
||||
changeDisplayName : PropTypes.func.isRequired,
|
||||
classes : PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useState } from 'react';
|
||||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import { withRoomContext } from '../RoomContext';
|
||||
@@ -139,7 +139,7 @@ Lobby.propTypes =
|
||||
roomClient : PropTypes.any.isRequired,
|
||||
url : PropTypes.string.isRequired,
|
||||
displayName : PropTypes.string.isRequired,
|
||||
loginEnabled : PropTypes.string.isRequired,
|
||||
loginEnabled : PropTypes.bool.isRequired,
|
||||
changeDisplayName : PropTypes.func.isRequired,
|
||||
classes : PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
@@ -24,11 +24,7 @@ const settings = (state = initialState, action) =>
|
||||
|
||||
case 'SET_DISPLAY_NAME':
|
||||
{
|
||||
let { displayName } = action.payload;
|
||||
|
||||
// Be ready for undefined displayName (so keep previous one).
|
||||
if (!displayName)
|
||||
displayName = state.displayName;
|
||||
const { displayName } = action.payload;
|
||||
|
||||
return { ...state, displayName };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user