mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
Placed the join command outside of the processCommand method
This commit is contained in:
parent
a40bb59dc0
commit
176caf340f
@ -218,6 +218,19 @@ export class RoomViewModel extends ViewModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
this._timelineError = null;
|
||||||
|
this.emitChange("error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async _processCommand (message) {
|
async _processCommand (message) {
|
||||||
let msgtype = undefined;
|
let msgtype = undefined;
|
||||||
const [commandName, ...args] = message.substring(1).split(" ");
|
const [commandName, ...args] = message.substring(1).split(" ");
|
||||||
@ -229,16 +242,7 @@ export class RoomViewModel extends ViewModel {
|
|||||||
case "join":
|
case "join":
|
||||||
if (args.length == 1) {
|
if (args.length == 1) {
|
||||||
const roomName = args[0];
|
const roomName = args[0];
|
||||||
const exc = await this.joinRoom(roomName);
|
await this._processCommandJoin(roomName);
|
||||||
if (exc !== true) {
|
|
||||||
if (exc && exc.stack && exc.message) {
|
|
||||||
this._sendError = exc;
|
|
||||||
} else {
|
|
||||||
this._sendError = new Error("/join : " + exc);
|
|
||||||
}
|
|
||||||
this._timelineError = null;
|
|
||||||
this.emitChange("error");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this._sendError = new Error("join syntax: /join <room-id>");
|
this._sendError = new Error("join syntax: /join <room-id>");
|
||||||
this._timelineError = null;
|
this._timelineError = null;
|
||||||
|
Loading…
Reference in New Issue
Block a user