Merge pull request #11337 from pedrobmarin/fix-mobile-label

Fix mobile user-list identification
This commit is contained in:
Anton Georgiev 2021-02-08 09:27:14 -05:00 committed by GitHub
commit e6d43de1cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 14 deletions

View File

@ -2,9 +2,10 @@ import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import Logger from '/imports/startup/server/logger';
import setMobile from '../modifiers/setMobile';
import { extractCredentials } from '/imports/api/common/server/helpers';
export default function setMobileUser(credentials) {
const { meetingId, requesterUserId } = credentials;
export default function setMobileUser() {
const { meetingId, requesterUserId } = extractCredentials(this.userId);
check(meetingId, String);
check(requesterUserId, String);

View File

@ -3,9 +3,6 @@ import { check } from 'meteor/check';
import Users from '/imports/api/users';
export default function setMobile(meetingId, userId) {
check(meetingId, String);
check(userId, String);
const selector = {
meetingId,
userId,
@ -17,16 +14,13 @@ export default function setMobile(meetingId, userId) {
},
};
const cb = (err, numChanged) => {
if (err) {
Logger.error(`Assigning mobile user: ${err}`);
return;
}
try {
const numberAffected = Users.update(selector, modifier);
if (numChanged) {
if (numberAffected) {
Logger.info(`Assigned mobile user id=${userId} meeting=${meetingId}`);
}
};
return Users.update(selector, modifier, cb);
} catch (err) {
Logger.error(`Assigning mobile user: ${err}`);
}
}