mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
Check conf user/rooms a bit more efficiently
This commit is contained in:
parent
77401e215e
commit
e3b02a295c
@ -30,15 +30,8 @@ ConferenceHandler.prototype._joinConferenceUser = function() {
|
|||||||
if (!groupRoom) {
|
if (!groupRoom) {
|
||||||
return q.reject("Bad group room ID");
|
return q.reject("Bad group room ID");
|
||||||
}
|
}
|
||||||
var members = groupRoom.getJoinedMembers();
|
var member = groupRoom.getMember(this.confUserId);
|
||||||
var confUserExists = false;
|
if (member && member.membership === "join") {
|
||||||
for (var i = 0; i < members.length; i++) {
|
|
||||||
if (members[i].userId === this.confUserId) {
|
|
||||||
confUserExists = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (confUserExists) {
|
|
||||||
return q();
|
return q();
|
||||||
}
|
}
|
||||||
return this.client.invite(this.groupRoomId, this.confUserId);
|
return this.client.invite(this.groupRoomId, this.confUserId);
|
||||||
@ -49,7 +42,8 @@ ConferenceHandler.prototype._getConferenceUserRoom = function() {
|
|||||||
var rooms = this.client.getRooms();
|
var rooms = this.client.getRooms();
|
||||||
var confRoom = null;
|
var confRoom = null;
|
||||||
for (var i = 0; i < rooms.length; i++) {
|
for (var i = 0; i < rooms.length; i++) {
|
||||||
if (rooms[i].hasMembershipState(this.confUserId, "join") &&
|
var confUser = rooms[i].getMember(this.confUserId);
|
||||||
|
if (confUser && confUser.membership === "join" &&
|
||||||
rooms[i].getJoinedMembers().length === 2) {
|
rooms[i].getJoinedMembers().length === 2) {
|
||||||
confRoom = rooms[i];
|
confRoom = rooms[i];
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user