29 lines
946 B
JavaScript
29 lines
946 B
JavaScript
import { check } from 'meteor/check';
|
|
import Logger from '/imports/startup/server/logger';
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
|
|
|
export default async function setMobileUser() {
|
|
try {
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
|
const EVENT_NAME = 'ChangeUserMobileFlagReqMsg';
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
|
|
|
check(meetingId, String);
|
|
check(requesterUserId, String);
|
|
|
|
const payload = {
|
|
userId: requesterUserId,
|
|
mobile: true,
|
|
};
|
|
|
|
Logger.verbose(`Mobile user ${requesterUserId} from meeting ${meetingId}`);
|
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
|
} catch (err) {
|
|
Logger.error(`Exception while invoking method setMobileUser ${err.stack}`);
|
|
}
|
|
}
|