2017-02-07 23:29:27 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2017-02-06 23:56:09 +08:00
|
|
|
import { check } from 'meteor/check';
|
2017-10-12 10:00:28 +08:00
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
2020-02-14 03:19:29 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2021-05-06 00:47:43 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2016-04-28 05:04:15 +08:00
|
|
|
|
2020-05-22 22:45:28 +08:00
|
|
|
export default function removeUser(userId, banUser) {
|
2021-05-06 00:47:43 +08:00
|
|
|
try {
|
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
|
|
const EVENT_NAME = 'EjectUserFromMeetingCmdMsg';
|
2017-02-06 23:56:09 +08:00
|
|
|
|
2021-05-06 00:47:43 +08:00
|
|
|
const { meetingId, requesterUserId: ejectedBy } = extractCredentials(this.userId);
|
2017-02-06 23:56:09 +08:00
|
|
|
|
2021-05-06 00:47:43 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(ejectedBy, String);
|
|
|
|
check(userId, String);
|
|
|
|
check(banUser, Boolean);
|
2017-02-06 23:56:09 +08:00
|
|
|
|
2021-05-06 00:47:43 +08:00
|
|
|
const payload = {
|
|
|
|
userId,
|
|
|
|
ejectedBy,
|
|
|
|
banUser,
|
|
|
|
};
|
2017-02-06 23:56:09 +08:00
|
|
|
|
2021-05-06 00:47:43 +08:00
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, ejectedBy, payload);
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method removeUser ${err.stack}`);
|
|
|
|
}
|
2020-06-13 03:51:22 +08:00
|
|
|
}
|