2017-06-28 06:14:53 +08:00
|
|
|
import Auth from '/imports/ui/services/auth';
|
2021-10-20 04:35:39 +08:00
|
|
|
import Breakouts from '/imports/api/breakouts';
|
2018-02-16 03:42:50 +08:00
|
|
|
|
2018-12-28 00:20:03 +08:00
|
|
|
const getBreakouts = () => Breakouts.find({ parentMeetingId: Auth.meetingID })
|
|
|
|
.fetch()
|
|
|
|
.sort((a, b) => a.sequence - b.sequence);
|
|
|
|
|
2021-11-24 00:04:45 +08:00
|
|
|
const currentBreakoutUsers = (user) => !Breakouts.findOne({
|
2019-05-01 03:24:04 +08:00
|
|
|
'joinedUsers.userId': new RegExp(`^${user.userId}`),
|
|
|
|
});
|
2019-02-08 00:42:47 +08:00
|
|
|
|
2021-11-24 00:04:45 +08:00
|
|
|
const filterBreakoutUsers = (filter) => (users) => users.filter(filter);
|
2019-02-08 03:40:27 +08:00
|
|
|
|
2022-03-24 21:56:07 +08:00
|
|
|
const getUsersNotJoined = filterBreakoutUsers(currentBreakoutUsers);
|
2019-01-17 01:41:21 +08:00
|
|
|
|
2021-11-24 00:04:45 +08:00
|
|
|
const isMe = (intId) => intId === Auth.userID;
|
2021-02-04 21:59:13 +08:00
|
|
|
|
2016-12-21 02:06:01 +08:00
|
|
|
export default {
|
2021-02-04 21:59:13 +08:00
|
|
|
isMe,
|
2020-01-22 23:31:53 +08:00
|
|
|
breakoutJoinedUsers: () => Breakouts.find({
|
|
|
|
joinedUsers: { $exists: true },
|
|
|
|
}, { fields: { joinedUsers: 1, breakoutId: 1, sequence: 1 }, sort: { sequence: 1 } }).fetch(),
|
2018-12-28 00:20:03 +08:00
|
|
|
getBreakouts,
|
2022-03-24 21:56:07 +08:00
|
|
|
getUsersNotJoined,
|
2016-12-21 02:06:01 +08:00
|
|
|
};
|