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';
|
2016-04-28 05:04:15 +08:00
|
|
|
|
2017-02-06 23:56:09 +08:00
|
|
|
export default function kickUser(credentials, userId) {
|
|
|
|
const REDIS_CONFIG = Meteor.settings.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
|
|
|
|
2017-10-12 09:02:23 +08:00
|
|
|
const { requesterUserId, meetingId } = credentials;
|
2017-02-06 23:56:09 +08:00
|
|
|
|
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
|
|
|
check(userId, String);
|
|
|
|
|
2017-06-03 03:25:02 +08:00
|
|
|
const payload = {
|
2017-10-12 09:02:23 +08:00
|
|
|
userId,
|
|
|
|
ejectedBy: requesterUserId,
|
2017-02-06 23:56:09 +08:00
|
|
|
};
|
|
|
|
|
2017-11-25 06:03:17 +08:00
|
|
|
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
2017-06-03 03:25:02 +08:00
|
|
|
}
|