bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/actions-bar/service.js

40 lines
1.3 KiB
JavaScript
Raw Normal View History

import Auth from '/imports/ui/services/auth';
import Users from '/imports/api/users';
import Meetings from '/imports/api/meetings';
import Breakouts from '/imports/api/breakouts';
2018-02-16 03:42:50 +08:00
const DIAL_IN_USER = 'dial-in-user';
2019-02-12 07:35:36 +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({
'joinedUsers.userId': new RegExp(`^${user.userId}`),
});
2021-11-24 00:04:45 +08:00
const filterBreakoutUsers = (filter) => (users) => users.filter(filter);
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;
export default {
isMe,
2024-04-25 21:51:20 +08:00
meetingName: () => Meetings.findOne({ meetingId: Auth.meetingID },
{ fields: { name: 1 } })?.name,
users: () => Users.find({
meetingId: Auth.meetingID,
clientType: { $ne: DIAL_IN_USER },
}).fetch(),
groups: () => Meetings.findOne({ meetingId: Auth.meetingID },
{ fields: { groups: 1 } })?.groups,
isBreakoutRecordable: () => Meetings.findOne({ meetingId: Auth.meetingID },
{ fields: { 'breakoutProps.record': 1 } })?.breakoutProps?.record,
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,
getUsersNotJoined,
};