joinpublicromm error msg fix

This commit is contained in:
jusax23 2023-03-29 19:19:58 +02:00
parent c22ca39e3b
commit 27bdd2e15b
Signed by: jusax23
GPG key ID: 499E2AA870C1CD41

View file

@ -316,21 +316,25 @@ export const joinPublicRoom: Act = {
return void aws("error", "existence"); return void aws("error", "existence");
} }
if (await isRoomFull(roomID)) return void aws("error", "limit"); if (await isRoomFull(roomID)) return void aws("error", "limit");
let queryx = await insert( try {
roomMembers.roomID, let queryx = await insert(
roomMembers.name, roomMembers.roomID,
roomMembers.server, roomMembers.name,
roomMembers.admin roomMembers.server,
).add( roomMembers.admin
roomID, ).add(
client.name, roomID,
client.state == STATE.remote ? client.server.tag : "local", client.name,
0 client.state == STATE.remote ? client.server.tag : "local",
).query(db); 0
if (queryx.affectedRows > 0) { ).query(db);
aws("ok", ""); if (queryx.affectedRows > 0) {
} else { aws("ok", "");
aws("error", "server"); } else {
aws("error", "duplicate");
}
} catch (error) {
aws("error", "duplicate");
} }
} }
}; };