diff --git a/src/domain/session/room/RoomViewModel.js b/src/domain/session/room/RoomViewModel.js index 74cb3d05..47d8c628 100644 --- a/src/domain/session/room/RoomViewModel.js +++ b/src/domain/session/room/RoomViewModel.js @@ -199,40 +199,30 @@ export class RoomViewModel extends ViewModel { } async joinRoom(roomName) { + } + + async _processCommandJoin(roomName) { try { const roomId = await this._options.client.session.joinRoom(roomName); const roomStatusObserver = await this._options.client.session.observeRoomStatus(roomId); await roomStatusObserver.waitFor(status => status === RoomStatus.Joined); this.navigation.push("room", roomId); - return true; } catch (exc) { if ((exc.statusCode ?? exc.status) === 400) { - return `'${roomName}' was not legal room ID or room alias`; + exc = new Error(`/join : '${roomName}' was not legal room ID or room alias`); } else if ((exc.statusCode ?? exc.status) === 404 || (exc.statusCode ?? exc.status) === 502 || exc.message == "Internal Server Error") { - return `room '${roomName}' not found`; + exc = new Error(`/join : room '${roomName}' not found`); } else if ((exc.statusCode ?? exc.status) === 403) { - return `you're not invited to join '${roomName}'`; - } else { - return exc; - } - } - } - - async _processCommandJoin(roomName) { - const exc = await this.joinRoom(roomName); - if (exc !== true) { - if (exc && exc.stack && exc.message) { - this._sendError = exc; - } else { - this._sendError = new Error("/join : " + exc); + exc = new Error(`/join : you're not invited to join '${roomName}'`); } + this._sendError = exc; this._timelineError = null; this.emitChange("error"); } } async _processCommand (message) { - let msgtype = undefined; + let msgtype; const [commandName, ...args] = message.substring(1).split(" "); switch (commandName) { case "me": @@ -269,7 +259,6 @@ export class RoomViewModel extends ViewModel { this._sendError = new Error(`no command name "${commandName}". To send the message instead of executing, please type "/${message}"`); this._timelineError = null; this.emitChange("error"); - msgtype = undefined; message = undefined; } return {type: msgtype, message: message}; diff --git a/src/platform/web/ui/css/themes/element/theme.css b/src/platform/web/ui/css/themes/element/theme.css index 0f40bdf3..05681cbb 100644 --- a/src/platform/web/ui/css/themes/element/theme.css +++ b/src/platform/web/ui/css/themes/element/theme.css @@ -539,7 +539,7 @@ a { } .RoomView_error:not(:empty) { - height : 40px; + height : auto; padding-top : 20px; padding-bottom : 20px; } @@ -572,7 +572,7 @@ a { content:"\274c"; position : absolute; top : 15px; - left: 10px; + left: 9px; width : 20px; height : 10px; font-size : 10px;