2019-04-06 06:32:21 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import UserInfos from '/imports/api/users-infos';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
2020-02-07 04:47:28 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2019-04-06 06:32:21 +08:00
|
|
|
|
2020-02-07 04:47:28 +08:00
|
|
|
function userInfos() {
|
|
|
|
if (!this.userId) {
|
|
|
|
return UserInfos.find({ meetingId: '' });
|
|
|
|
}
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
2019-04-06 06:32:21 +08:00
|
|
|
|
2020-11-24 03:35:59 +08:00
|
|
|
Logger.debug('Publishing user infos requested', { requesterUserId });
|
2019-04-06 06:32:21 +08:00
|
|
|
|
|
|
|
return UserInfos.find({ meetingId, requesterUserId });
|
|
|
|
}
|
|
|
|
|
|
|
|
function publish(...args) {
|
|
|
|
const boundUserInfos = userInfos.bind(this);
|
|
|
|
return boundUserInfos(...args);
|
|
|
|
}
|
|
|
|
|
|
|
|
Meteor.publish('users-infos', publish);
|