mirror of
https://github.com/webxoss/webxoss-core.git
synced 2024-11-20 06:49:53 +01:00
fix bugs of renaming room
recovery previous room name when fail to rename room add `onblur` listener to #room-name element
This commit is contained in:
parent
4b384f1b9d
commit
37782768f7
3 changed files with 13 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -3,3 +3,4 @@ trash
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.sublime-*
|
*.sublime-*
|
||||||
yarn.lock
|
yarn.lock
|
||||||
|
.vscode/
|
|
@ -218,16 +218,26 @@ RoomManager.prototype.renameRoom = function (client,cfg) {
|
||||||
}
|
}
|
||||||
var oldRoomName = client.room.name;
|
var oldRoomName = client.room.name;
|
||||||
var newRoomName = cfg.roomName;
|
var newRoomName = cfg.roomName;
|
||||||
|
if (newRoomName === oldRoomName) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!errMsg) {
|
if (!errMsg) {
|
||||||
errMsg = this.checkRoomName(newRoomName);
|
errMsg = this.checkRoomName(newRoomName);
|
||||||
}
|
}
|
||||||
var room;
|
var room;
|
||||||
|
if (!errMsg) {
|
||||||
|
if (newRoomName in this.roomMap) {
|
||||||
|
errMsg = 'ROOM_ALREADY_EXISTS';
|
||||||
|
client.room.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!errMsg) {
|
if (!errMsg) {
|
||||||
room = this.roomMap[oldRoomName];
|
room = this.roomMap[oldRoomName];
|
||||||
if (!room) {
|
if (!room) {
|
||||||
errMsg = 'ROOM_DOES_NOT_EXIST';
|
errMsg = 'ROOM_DOES_NOT_EXIST';
|
||||||
} else if (client.getPosition() !== 'host') {
|
} else if (client.getPosition() !== 'host') {
|
||||||
errMsg = 'YOU_ARE_NOT_ROOM_HOST';
|
errMsg = 'YOU_ARE_NOT_ROOM_HOST';
|
||||||
|
client.room.update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errMsg) {
|
if (errMsg) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 51a710f84c2931e55ca71009ad469468b5662863
|
Subproject commit 36727dd62e19545ca9a0abcc25124e7858c788aa
|
Loading…
Reference in a new issue