use room membership for chat invitations instead of community membership to fix presence bug

This commit is contained in:
Sharon Kennedy 2020-05-27 22:24:14 -04:00
parent cb4282999a
commit 189140e1f9

View File

@ -109,11 +109,10 @@ class OcrccBot {
let chatOffline = true;
try {
const data = await this.client.getGroupUsers(this.config.FACILITATOR_GROUP_ID)
const members = data.chunk
const roomMembers = await this.client.getJoinedRoomMembers(this.config.FACILITATOR_ROOM_ID)
const members = Object.keys(roomMembers["joined"]);
members.forEach(member => {
const memberId = member.user_id;
members.forEach(memberId => {
const user = this.client.getUser(memberId);
if (
user &&
@ -142,18 +141,17 @@ class OcrccBot {
this.localStorage.removeItem(`${roomId}-waiting`)
try {
const groupUsers = await this.client.getGroupUsers(this.config.FACILITATOR_GROUP_ID)
const roomMembers = await this.client.getJoinedRoomMembers(roomId)
const facilitatorsRoomMembers = await this.client.getJoinedRoomMembers(this.config.FACILITATOR_ROOM_ID)
const supportRoomMembers = await this.client.getJoinedRoomMembers(roomId)
const roomMemberIds = Object.keys(roomMembers["joined"]);
const groupMemberIds = groupUsers["chunk"]
const roomMembersIds = Object.keys(supportRoomMembers["joined"]);
const facilitatorsIds = Object.keys(facilitatorsRoomMembers["joined"]);
if (!roomMemberIds || !groupMemberIds) return;
if (!roomMembersIds || !facilitatorsIds) return;
const facilitatorsIds = groupMemberIds.map(f => f.user_id);
facilitatorsIds.forEach(f => {
if (!roomMemberIds.includes(f)) {
if (!roomMembersIds.includes(f)) {
this.kickUserFromRoom(roomId, f);
}
});