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");
}
if (await isRoomFull(roomID)) return void aws("error", "limit");
let queryx = await insert(
roomMembers.roomID,
roomMembers.name,
roomMembers.server,
roomMembers.admin
).add(
roomID,
client.name,
client.state == STATE.remote ? client.server.tag : "local",
0
).query(db);
if (queryx.affectedRows > 0) {
aws("ok", "");
} else {
aws("error", "server");
try {
let queryx = await insert(
roomMembers.roomID,
roomMembers.name,
roomMembers.server,
roomMembers.admin
).add(
roomID,
client.name,
client.state == STATE.remote ? client.server.tag : "local",
0
).query(db);
if (queryx.affectedRows > 0) {
aws("ok", "");
} else {
aws("error", "duplicate");
}
} catch (error) {
aws("error", "duplicate");
}
}
};