From d8a2cb3883fedcccb493aaba352dc7d3a9e38e5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Francisco=20Siebel?= Date: Tue, 20 Nov 2018 17:44:05 -0200 Subject: [PATCH 1/2] set html5 client as pod presenter. close #6109 and close #5941 --- .../server/handlers/presenterAssigned.js | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/bigbluebutton-html5/imports/api/users/server/handlers/presenterAssigned.js b/bigbluebutton-html5/imports/api/users/server/handlers/presenterAssigned.js index 105772c232..6c4895fdc7 100644 --- a/bigbluebutton-html5/imports/api/users/server/handlers/presenterAssigned.js +++ b/bigbluebutton-html5/imports/api/users/server/handlers/presenterAssigned.js @@ -1,10 +1,13 @@ import Users from '/imports/api/users'; +import PresentationPods from '/imports/api/presentation-pods'; import changeRole from '/imports/api/users/server/modifiers/changeRole'; +import assignPresenter from '../methods/assignPresenter'; -export default function handlePresenterAssigned({ body }, meetingId) { +export default function handlePresenterAssigned(credentials, meetingId) { const USER_CONFIG = Meteor.settings.public.user; const ROLE_PRESENTER = USER_CONFIG.role_presenter; + const { body } = credentials; const { presenterId, assignedBy } = body; changeRole(ROLE_PRESENTER, true, presenterId, meetingId, assignedBy); @@ -15,11 +18,32 @@ export default function handlePresenterAssigned({ body }, meetingId) { presenter: true, }; + const defaultPodSelector = { + podId: 'DEFAULT_PRESENTATION_POD', + }; + const prevPresenter = Users.findOne(selector); // no previous presenters if (!prevPresenter) { - return true; + const currentDefaultPodPresenter = PresentationPods.findOne(defaultPodSelector); + + const { currentPresenterId } = currentDefaultPodPresenter; + + const fakeCredentials = { + meetingId, + requesterUserId: assignedBy, + }; + + if (currentDefaultPodPresenter.currentPresenterId !== '') { + const oldPresenter = Users.findOne({ userId: currentPresenterId }); + + if (oldPresenter.connectionStatus === 'offline') { + return assignPresenter(fakeCredentials, presenterId); + } + return true; + } + return assignPresenter(fakeCredentials, presenterId); } return changeRole(ROLE_PRESENTER, false, prevPresenter.userId, meetingId, assignedBy); From 877b9335b3625f6baf4399d37f4ca4b21fc1cf3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Francisco=20Siebel?= Date: Tue, 20 Nov 2018 18:14:17 -0200 Subject: [PATCH 2/2] rename variable and add comments for better understanding --- .../api/users/server/handlers/presenterAssigned.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bigbluebutton-html5/imports/api/users/server/handlers/presenterAssigned.js b/bigbluebutton-html5/imports/api/users/server/handlers/presenterAssigned.js index 6c4895fdc7..ddd2320408 100644 --- a/bigbluebutton-html5/imports/api/users/server/handlers/presenterAssigned.js +++ b/bigbluebutton-html5/imports/api/users/server/handlers/presenterAssigned.js @@ -25,12 +25,14 @@ export default function handlePresenterAssigned(credentials, meetingId) { const prevPresenter = Users.findOne(selector); // no previous presenters + // The below code is responsible for set Meeting presenter to be default pod presenter as well. + // It's been handled here because right now akka-apps don't handle all cases scenarios. if (!prevPresenter) { const currentDefaultPodPresenter = PresentationPods.findOne(defaultPodSelector); const { currentPresenterId } = currentDefaultPodPresenter; - const fakeCredentials = { + const podPresenterCredentials = { meetingId, requesterUserId: assignedBy, }; @@ -39,11 +41,11 @@ export default function handlePresenterAssigned(credentials, meetingId) { const oldPresenter = Users.findOne({ userId: currentPresenterId }); if (oldPresenter.connectionStatus === 'offline') { - return assignPresenter(fakeCredentials, presenterId); + return assignPresenter(podPresenterCredentials, presenterId); } return true; } - return assignPresenter(fakeCredentials, presenterId); + return assignPresenter(podPresenterCredentials, presenterId); } return changeRole(ROLE_PRESENTER, false, prevPresenter.userId, meetingId, assignedBy);