bigbluebutton-Github/bigbluebutton-html5/imports/api/meetings/server/methods/transferUser.js

24 lines
841 B
JavaScript
Raw Normal View History

2018-10-17 01:55:20 +08:00
import { Meteor } from 'meteor/meteor';
import RedisPubSub from '/imports/startup/server/redis';
import Logger from '/imports/startup/server/logger';
import { extractCredentials } from '/imports/api/common/server/helpers';
2018-10-17 01:55:20 +08:00
export default function transferUser(fromMeetingId, toMeetingId) {
2018-10-17 01:55:20 +08:00
const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'TransferUserToMeetingRequestMsg';
const { meetingId, requesterUserId } = extractCredentials(this.userId);
2018-10-17 01:55:20 +08:00
const payload = {
2018-10-24 01:18:09 +08:00
fromMeetingId,
2018-10-17 01:55:20 +08:00
toMeetingId,
userId: requesterUserId,
};
Logger.verbose('User was transferred from one meting to another', { requesterUserId, fromMeetingId, toMeetingId });
2018-10-17 01:55:20 +08:00
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}