diff --git a/bigbluebutton-html5/imports/api/cursor/server/handlers/cursorUpdate.js b/bigbluebutton-html5/imports/api/cursor/server/handlers/cursorUpdate.js index 535c53a9d4..e8e1096ac7 100644 --- a/bigbluebutton-html5/imports/api/cursor/server/handlers/cursorUpdate.js +++ b/bigbluebutton-html5/imports/api/cursor/server/handlers/cursorUpdate.js @@ -2,13 +2,14 @@ import { check } from 'meteor/check'; import updateCursor from '../modifiers/updateCursor'; export default function handleCursorUpdate({ header, body }, meetingId) { - const userId = header.userId; - const x = body.xPercent; - const y = body.yPercent; + const { userId } = header; + check(body, Object); + const { whiteboardId, xPercent: x, yPercent: y } = body; + check(whiteboardId, String); check(userId, String); check(x, Number); check(y, Number); - return updateCursor(meetingId, userId, x, y); + return updateCursor(meetingId, whiteboardId, userId, x, y); } diff --git a/bigbluebutton-html5/imports/api/cursor/server/modifiers/updateCursor.js b/bigbluebutton-html5/imports/api/cursor/server/modifiers/updateCursor.js index af1ccc9472..808aacc5e5 100644 --- a/bigbluebutton-html5/imports/api/cursor/server/modifiers/updateCursor.js +++ b/bigbluebutton-html5/imports/api/cursor/server/modifiers/updateCursor.js @@ -2,7 +2,7 @@ import Logger from '/imports/startup/server/logger'; import Cursor from '/imports/api/cursor'; import { check } from 'meteor/check'; -export default function updateCursor(meetingId, userId, x = -1, y = -1) { +export default function updateCursor(meetingId, whiteboardId, userId, x = -1, y = -1) { check(meetingId, String); check(userId, String); check(x, Number); @@ -10,13 +10,15 @@ export default function updateCursor(meetingId, userId, x = -1, y = -1) { const selector = { meetingId, + whiteboardId, userId, }; const modifier = { $set: { - userId, meetingId, + whiteboardId, + userId, x, y, }, diff --git a/bigbluebutton-html5/imports/ui/components/presentation/component.jsx b/bigbluebutton-html5/imports/ui/components/presentation/component.jsx index abb028faa0..c85ae0a0b9 100644 --- a/bigbluebutton-html5/imports/ui/components/presentation/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/presentation/component.jsx @@ -200,6 +200,7 @@ export default class PresentationArea extends Component { whiteboardId={slideObj.id} /> { - const { whiteboardId } = params; - const { presenterCursorId, multiUserCursorIds } = CursorWrapperService.getCurrentCursorIds(whiteboardId); + const { podId, whiteboardId } = params; + const cursorIds = CursorWrapperService.getCurrentCursorIds(podId, whiteboardId); + const { presenterCursorId, multiUserCursorIds } = cursorIds; + const isMultiUser = CursorWrapperService.getMultiUserStatus(whiteboardId); return { diff --git a/bigbluebutton-html5/imports/ui/components/presentation/cursor/cursor-wrapper-container/service.js b/bigbluebutton-html5/imports/ui/components/presentation/cursor/cursor-wrapper-container/service.js index c773c80799..62ddd81573 100644 --- a/bigbluebutton-html5/imports/ui/components/presentation/cursor/cursor-wrapper-container/service.js +++ b/bigbluebutton-html5/imports/ui/components/presentation/cursor/cursor-wrapper-container/service.js @@ -1,25 +1,31 @@ import WhiteboardMultiUser from '/imports/api/whiteboard-multi-user/'; +import PresentationPods from '/imports/api/presentation-pods'; import Auth from '/imports/ui/services/auth'; import Cursor from '/imports/api/cursor'; -import Users from '/imports/api/users'; const getMultiUserStatus = (whiteboardId) => { const data = WhiteboardMultiUser.findOne({ meetingId: Auth.meetingID, whiteboardId }); return data ? data.multiUser : false; }; -const getPresenterCursorId = userId => Cursor.findOne({ userId }, { fields: { _id: 1 } }); +const getPresenterCursorId = (whiteboardId, userId) => + Cursor.findOne( + { + whiteboardId, + userId, + }, + { fields: { _id: 1 } }, + ); -const getCurrentCursorIds = (whiteboardId) => { +const getCurrentCursorIds = (podId, whiteboardId) => { // object to return const data = {}; - // fetching the presenter's id - const user = Users.findOne({ presenter: true }, { fields: { userId: 1 } }); - - if (user) { + // fetching the pod owner's id + const pod = PresentationPods.findOne({ meetingId: Auth.meetingID, podId }); + if (pod) { // fetching the presenter cursor id - data.presenterCursorId = getPresenterCursorId(user.userId); + data.presenterCursorId = getPresenterCursorId(whiteboardId, pod.currentPresenterId); } // checking whether multiUser mode is on or off @@ -27,7 +33,7 @@ const getCurrentCursorIds = (whiteboardId) => { // it's a multi-user mode - fetching all the cursors except the presenter's if (isMultiUser) { - let selector = {}; + const selector = { whiteboardId }; const filter = { fields: { _id: 1, @@ -36,10 +42,8 @@ const getCurrentCursorIds = (whiteboardId) => { // if there is a presenter cursor - excluding it from the query if (data.presenterCursorId) { - selector = { - _id: { - $ne: data.presenterCursorId._id, - }, + selector._id = { + $ne: data.presenterCursorId._id, }; }