Breackouts history back-end migrated to new async API
This commit is contained in:
parent
c701ff5c66
commit
6472cf8d0d
@ -7,7 +7,7 @@ const collectionOptions = Meteor.isClient ? {
|
||||
const BreakoutsHistory = new Mongo.Collection('breakouts-history', collectionOptions);
|
||||
|
||||
if (Meteor.isServer) {
|
||||
BreakoutsHistory._ensureIndex({ meetingId: 1 });
|
||||
BreakoutsHistory.createIndexAsync({ meetingId: 1 });
|
||||
}
|
||||
|
||||
export default BreakoutsHistory;
|
||||
|
@ -2,7 +2,7 @@ import { check } from 'meteor/check';
|
||||
import BreakoutsHistory from '/imports/api/breakouts-history';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
export default function handleBreakoutRoomsList({ body }) {
|
||||
export default async function handleBreakoutRoomsList({ body }) {
|
||||
const {
|
||||
meetingId,
|
||||
rooms,
|
||||
@ -22,7 +22,7 @@ export default function handleBreakoutRoomsList({ body }) {
|
||||
};
|
||||
|
||||
try {
|
||||
const { insertedId } = BreakoutsHistory.upsert(selector, modifier);
|
||||
const { insertedId } = await BreakoutsHistory.upsertAsync(selector, modifier);
|
||||
|
||||
if (insertedId) {
|
||||
Logger.info(`Added rooms to breakout-history Data: meeting=${meetingId}`);
|
||||
|
@ -2,8 +2,7 @@ import Logger from '/imports/startup/server/logger';
|
||||
import { check } from 'meteor/check';
|
||||
import BreakoutsHistory from '/imports/api/breakouts-history';
|
||||
|
||||
export default function handleSendMessageToAllBreakoutRoomsEvtMsg({ body }, meetingId) {
|
||||
|
||||
export default async function handleSendMessageToAllBreakoutRoomsEvtMsg({ body }, meetingId) {
|
||||
const {
|
||||
senderId,
|
||||
msg,
|
||||
@ -30,7 +29,7 @@ export default function handleSendMessageToAllBreakoutRoomsEvtMsg({ body }, meet
|
||||
};
|
||||
|
||||
try {
|
||||
const { insertedId } = BreakoutsHistory.upsert(selector, modifier);
|
||||
const { insertedId } = await BreakoutsHistory.upsertAsync(selector, modifier);
|
||||
|
||||
if (insertedId) {
|
||||
Logger.info(`Added broadCastMsg to breakout-history Data: meeting=${meetingId}`);
|
||||
|
@ -9,8 +9,9 @@ import { publicationSafeGuard } from '/imports/api/common/server/helpers';
|
||||
|
||||
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
|
||||
|
||||
function breakoutsHistory() {
|
||||
const tokenValidation = AuthTokenValidation.findOne({ connectionId: this.connection.id });
|
||||
async function breakoutsHistory() {
|
||||
const tokenValidation = await AuthTokenValidation
|
||||
.findOneAsync({ connectionId: this.connection.id });
|
||||
|
||||
if (!tokenValidation || tokenValidation.validationStatus !== ValidationStates.VALIDATED) {
|
||||
Logger.warn(`Publishing Meetings-history was requested by unauth connection ${this.connection.id}`);
|
||||
@ -20,7 +21,7 @@ function breakoutsHistory() {
|
||||
const { meetingId, userId } = tokenValidation;
|
||||
Logger.debug('Publishing Breakouts-History', { meetingId, userId });
|
||||
|
||||
const User = Users.findOne({ userId, meetingId }, { fields: { userId: 1, role: 1 } });
|
||||
const User = await Users.findOneAsync({ userId, meetingId }, { fields: { userId: 1, role: 1 } });
|
||||
if (!User || User.role !== ROLE_MODERATOR) {
|
||||
return BreakoutsHistory.find({ meetingId: '' });
|
||||
}
|
||||
@ -32,8 +33,9 @@ function breakoutsHistory() {
|
||||
};
|
||||
|
||||
// Monitor this publication and stop it when user is not a moderator anymore
|
||||
const comparisonFunc = () => {
|
||||
const user = Users.findOne({ userId, meetingId }, { fields: { role: 1, userId: 1 } });
|
||||
const comparisonFunc = async () => {
|
||||
const user = await Users
|
||||
.findOneAsync({ userId, meetingId }, { fields: { role: 1, userId: 1 } });
|
||||
const condition = user.role === ROLE_MODERATOR;
|
||||
|
||||
if (!condition) {
|
||||
|
Loading…
Reference in New Issue
Block a user