fix breakout room multiple invitations
This commit is contained in:
parent
baa0d0e2bd
commit
de53770d77
@ -15,13 +15,26 @@ export default function handleBreakoutJoinURL({ body }) {
|
||||
breakoutId,
|
||||
};
|
||||
|
||||
// only keep each users' last invitation
|
||||
const newUsers = [];
|
||||
|
||||
const currentBreakout = Breakouts.findOne({ breakoutId }, { fields: { users: 1 } });
|
||||
|
||||
currentBreakout.users.forEach((item) => {
|
||||
if (item.userId !== userId) {
|
||||
newUsers.push(item);
|
||||
}
|
||||
});
|
||||
|
||||
newUsers.push({
|
||||
userId,
|
||||
redirectToHtml5JoinURL,
|
||||
insertedTime: new Date().getTime(),
|
||||
});
|
||||
|
||||
const modifier = {
|
||||
$push: {
|
||||
users: {
|
||||
userId,
|
||||
redirectToHtml5JoinURL,
|
||||
insertedTime: new Date().getTime(),
|
||||
},
|
||||
$set: {
|
||||
users: newUsers,
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user