Getting join rules does not need user ID
parent
3977ea0074
commit
4bfa57b34e
|
@ -272,10 +272,6 @@ const onMessage = function(event) {
|
||||||
|
|
||||||
const roomId = event.data.room_id;
|
const roomId = event.data.room_id;
|
||||||
const userId = event.data.user_id;
|
const userId = event.data.user_id;
|
||||||
if (!userId) {
|
|
||||||
sendError(event, "Missing user_id in request");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!roomId) {
|
if (!roomId) {
|
||||||
sendError(event, "Missing room_id in request");
|
sendError(event, "Missing room_id in request");
|
||||||
return;
|
return;
|
||||||
|
@ -289,6 +285,16 @@ const onMessage = function(event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Getting join rules does not require userId
|
||||||
|
if (event.data.action === "join_rules_state") {
|
||||||
|
getJoinRules(event, roomId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!userId) {
|
||||||
|
sendError(event, "Missing user_id in request");
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch (event.data.action) {
|
switch (event.data.action) {
|
||||||
case "membership_state":
|
case "membership_state":
|
||||||
getMembershipState(event, roomId, userId);
|
getMembershipState(event, roomId, userId);
|
||||||
|
@ -305,9 +311,6 @@ const onMessage = function(event) {
|
||||||
case "set_bot_power":
|
case "set_bot_power":
|
||||||
setBotPower(event, roomId, userId, event.data.level);
|
setBotPower(event, roomId, userId, event.data.level);
|
||||||
break;
|
break;
|
||||||
case "join_rules_state":
|
|
||||||
getJoinRules(event, roomId);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
console.warn("Unhandled postMessage event with action '" + event.data.action +"'");
|
console.warn("Unhandled postMessage event with action '" + event.data.action +"'");
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue