Global username instead of per room (#1382)
* global username * remove string interpolation Co-Authored-By: Lipis <lipiridis@gmail.com> * remove string interpolation Co-Authored-By: Lipis <lipiridis@gmail.com> * remove backwards compat Co-authored-by: Lipis <lipiridis@gmail.com>
This commit is contained in:
@ -244,9 +244,7 @@ export class App extends React.Component<any, AppState> {
|
||||
onRoomCreate={this.openPortal}
|
||||
onRoomDestroy={this.closePortal}
|
||||
onUsernameChange={(username) => {
|
||||
if (this.portal.socket && this.portal.roomID && username) {
|
||||
saveUsernameToLocalStorage(this.portal.roomID, username);
|
||||
}
|
||||
saveUsernameToLocalStorage(username);
|
||||
this.setState({
|
||||
username,
|
||||
});
|
||||
@ -921,12 +919,12 @@ export class App extends React.Component<any, AppState> {
|
||||
);
|
||||
|
||||
this.portal.socket!.on("init-room", () => {
|
||||
if (this.portal.socket && this.portal.roomID) {
|
||||
const username = restoreUsernameFromLocalStorage(this.portal.roomID);
|
||||
if (this.portal.socket) {
|
||||
const username = restoreUsernameFromLocalStorage();
|
||||
|
||||
this.portal.socket.emit("join-room", this.portal.roomID);
|
||||
|
||||
if (username) {
|
||||
if (username !== null) {
|
||||
this.setState({
|
||||
username,
|
||||
});
|
||||
|
Reference in New Issue
Block a user