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';
|
2016-04-28 05:04:15 +08:00
|
|
|
|
2020-05-22 22:45:28 +08:00
|
|
|
export default function removeUser(userId, banUser) {
|
2018-01-08 08:24:05 +08:00
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
2017-10-12 09:02:23 +08:00
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
|
|
const EVENT_NAME = 'EjectUserFromMeetingCmdMsg';
|
2017-02-06 23:56:09 +08:00
|
|
|
|
2020-02-14 03:19:29 +08:00
|
|
|
const { meetingId, requesterUserId: ejectedBy } = extractCredentials(this.userId);
|
2017-02-06 23:56:09 +08:00
|
|
|
|
2021-03-17 00:15:41 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(ejectedBy, String);
|
2017-02-06 23:56:09 +08:00
|
|
|
check(userId, String);
|
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
const payload = {
|
2017-10-12 09:02:23 +08:00
|
|
|
userId,
|
2020-02-14 03:19:29 +08:00
|
|
|
ejectedBy,
|
2020-05-22 22:45:28 +08:00
|
|
|
banUser,
|
2017-02-06 23:56:09 +08:00
|
|
|
};
|
|
|
|
|
2020-02-14 03:19:29 +08:00
|
|
|
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, ejectedBy, payload);
|
2020-06-13 03:51:22 +08:00
|
|
|
}
|