Remove mapUser from lockSettingContextContainer

This commit is contained in:
Tainan Felipe 2019-07-30 17:00:38 -03:00
parent 39cf9b7279
commit da30c4c914
2 changed files with 9 additions and 5 deletions

View File

@ -1,19 +1,17 @@
import React from 'react';
import { withTracker } from 'meteor/react-meteor-data';
import Meetings from '/imports/api/meetings';
import Users from '/imports/api/users';
import Auth from '/imports/ui/services/auth';
import mapUser from '/imports/ui/services/user/mapUser';
import { LockStruct } from './context';
import { withLockContext } from './withContext';
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
const lockContextContainer = component => withTracker(() => {
const lockSetting = new LockStruct();
const Meeting = Meetings.findOne({ meetingId: Auth.meetingID });
const User = Users.findOne({ userId: Auth.userID });
const mappedUser = mapUser(User);
const userIsLocked = mappedUser.isLocked;
const userIsLocked = User.locked && User.role === ROLE_MODERATOR;
const lockSettings = Meeting.lockSettingsProps;
lockSetting.isLocked = userIsLocked;

View File

@ -17,7 +17,13 @@ export default withTracker(({ userId }) => {
user: mapUser(Users.findOne({ userId })),
userInBreakout: !!findUserInBreakout,
breakoutSequence,
currentUser: Users.findOne({ userId: Auth.userID }),
currentUser: Users.findOne({ userId: Auth.userID }, {
fields: {
role: 1,
locked: 1,
userId: 1,
},
}),
meetignIsBreakout: Meeting && Meeting.meetingProp.isBreakout,
isMeteorConnected: Meteor.status().connected,
};