Merge pull request #6348 from antobinary/revert-loop

Revert presenter assign 6270 6326
This commit is contained in:
Anton Georgiev 2018-12-06 14:18:46 -05:00 committed by GitHub
commit b29ee3a4bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,10 @@
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(credentials, meetingId) {
export default function handlePresenterAssigned({ body }, 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);
@ -18,34 +15,10 @@ export default function handlePresenterAssigned(credentials, meetingId) {
presenter: true,
};
const defaultPodSelector = {
podId: 'DEFAULT_PRESENTATION_POD',
};
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 podPresenterCredentials = {
meetingId,
requesterUserId: assignedBy,
};
if (currentPresenterId === '') {
return assignPresenter(podPresenterCredentials, presenterId);
}
const oldPresenter = Users.findOne({ userId: currentPresenterId, connectionStatus: 'offline' });
if (oldPresenter) {
return assignPresenter(podPresenterCredentials, presenterId);
}
return true;
}