2019-02-21 01:17:17 +08:00
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
|
|
|
import { check } from 'meteor/check';
|
2020-02-07 04:47:28 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2021-05-05 22:34:36 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2019-02-21 01:17:17 +08:00
|
|
|
|
2020-02-07 04:47:28 +08:00
|
|
|
export default function setPresentationDownloadable(presentationId, downloadable) {
|
2019-02-21 01:17:17 +08:00
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
2019-02-21 06:20:04 +08:00
|
|
|
const EVENT_NAME = 'SetPresentationDownloadablePubMsg';
|
2019-02-21 01:17:17 +08:00
|
|
|
|
2021-05-05 22:34:36 +08:00
|
|
|
try {
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
2019-02-21 01:17:17 +08:00
|
|
|
|
2021-05-05 22:34:36 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
|
|
|
check(downloadable, Boolean);
|
|
|
|
check(presentationId, String);
|
2019-02-21 01:17:17 +08:00
|
|
|
|
2021-05-05 22:34:36 +08:00
|
|
|
const payload = {
|
|
|
|
presentationId,
|
|
|
|
podId: 'DEFAULT_PRESENTATION_POD',
|
|
|
|
downloadable,
|
|
|
|
};
|
2019-02-21 01:17:17 +08:00
|
|
|
|
2021-05-05 22:34:36 +08:00
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method setPresentationDownloadable ${err.stack}`);
|
|
|
|
}
|
2019-02-21 01:17:17 +08:00
|
|
|
}
|