From d7c0975b6196c1a99860df00b63732c8f5d0e728 Mon Sep 17 00:00:00 2001 From: Pedro Beschorner Marin Date: Mon, 8 Feb 2021 09:55:38 -0300 Subject: [PATCH] Fix mobile user-list identification Added the missing extractCredential method and replaced the old callback strategy with the new try-catch block. --- .../api/users/server/methods/setMobileUser.js | 5 +++-- .../api/users/server/modifiers/setMobile.js | 18 ++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/bigbluebutton-html5/imports/api/users/server/methods/setMobileUser.js b/bigbluebutton-html5/imports/api/users/server/methods/setMobileUser.js index 6dd7d9be90..b20bb276eb 100644 --- a/bigbluebutton-html5/imports/api/users/server/methods/setMobileUser.js +++ b/bigbluebutton-html5/imports/api/users/server/methods/setMobileUser.js @@ -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); diff --git a/bigbluebutton-html5/imports/api/users/server/modifiers/setMobile.js b/bigbluebutton-html5/imports/api/users/server/modifiers/setMobile.js index 3f0a959ac5..7f6bc29730 100644 --- a/bigbluebutton-html5/imports/api/users/server/modifiers/setMobile.js +++ b/bigbluebutton-html5/imports/api/users/server/modifiers/setMobile.js @@ -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}`); + } }