Only allow calls to be placed if there are 2 joined members.
This commit is contained in:
parent
50f9d34211
commit
c056bdf104
1 changed files with 12 additions and 0 deletions
|
@ -122,6 +122,18 @@ dis.register(function(payload) {
|
||||||
if (calls[payload.room_id]) {
|
if (calls[payload.room_id]) {
|
||||||
return; // don't allow >1 call to be placed.
|
return; // don't allow >1 call to be placed.
|
||||||
}
|
}
|
||||||
|
var room = MatrixClientPeg.get().getRoom(payload.room_id);
|
||||||
|
if (!room) {
|
||||||
|
console.error("Room %s does not exist.", payload.room_id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (room.getJoinedMembers().length !== 2) {
|
||||||
|
console.error(
|
||||||
|
"Fail: There are %s joined members in this room, not 2.",
|
||||||
|
room.getJoinedMembers().length
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
console.log("Place %s call in %s", payload.type, payload.room_id);
|
console.log("Place %s call in %s", payload.type, payload.room_id);
|
||||||
var call = Matrix.createNewMatrixCall(
|
var call = Matrix.createNewMatrixCall(
|
||||||
MatrixClientPeg.get(), payload.room_id
|
MatrixClientPeg.get(), payload.room_id
|
||||||
|
|
Loading…
Reference in a new issue