Merge pull request #7833 from antobinary/minor-tweaks
Minor optimization using Fields in miniMongo
This commit is contained in:
commit
a37b90b140
@ -219,15 +219,33 @@ const BaseContainer = withTracker(() => {
|
||||
let breakoutRoomSubscriptionHandler;
|
||||
let meetingModeratorSubscriptionHandler;
|
||||
|
||||
const User = Users.findOne({ intId: credentials.requesterUserId });
|
||||
const meeting = Meetings.findOne({ meetingId });
|
||||
if (meeting) {
|
||||
const { meetingEnded } = meeting;
|
||||
if (meetingEnded) Session.set('codeError', '410');
|
||||
const fields = {
|
||||
approved: 1,
|
||||
authed: 1,
|
||||
ejected: 1,
|
||||
color: 1,
|
||||
effectiveConnectionType: 1,
|
||||
extId: 1,
|
||||
guest: 1,
|
||||
intId: 1,
|
||||
locked: 1,
|
||||
loggedOut: 1,
|
||||
meetingId: 1,
|
||||
userId: 1,
|
||||
};
|
||||
const User = Users.findOne({ intId: credentials.requesterUserId }, { fields });
|
||||
const meeting = Meetings.findOne({ meetingId }, {
|
||||
fields: {
|
||||
meetingEnded: 1,
|
||||
},
|
||||
});
|
||||
|
||||
if (meeting && meeting.meetingEnded) {
|
||||
Session.set('codeError', '410');
|
||||
}
|
||||
|
||||
const approved = !!Users.findOne({ userId: Auth.userID, approved: true, guest: true });
|
||||
const ejected = Users.findOne({ userId: Auth.userID, ejected: true });
|
||||
const approved = User && User.approved && User.guest;
|
||||
const ejected = User && User.ejected;
|
||||
let userSubscriptionHandler;
|
||||
|
||||
|
||||
@ -252,7 +270,7 @@ const BaseContainer = withTracker(() => {
|
||||
},
|
||||
});
|
||||
|
||||
Meetings.find({ meetingId }).observe({
|
||||
Meetings.find({ meetingId }, { fields: { recordProp: 1 } }).observe({
|
||||
changed: (newDocument, oldDocument) => {
|
||||
if (newDocument.recordProp) {
|
||||
if (!oldDocument.recordProp.recording && newDocument.recordProp.recording) {
|
||||
|
@ -22,7 +22,7 @@ const ActionsBarContainer = props => <ActionsBar {...props} />;
|
||||
export default withTracker(() => {
|
||||
const POLLING_ENABLED = Meteor.settings.public.poll.enabled;
|
||||
|
||||
Meetings.find({ meetingId: Auth.meetingID }).observeChanges({
|
||||
Meetings.find({ meetingId: Auth.meetingID }, { fields: { recordProp: 1 } }).observeChanges({
|
||||
changed: (id, fields) => {
|
||||
if (fields.recordProp && fields.recordProp.recording) {
|
||||
this.window.parent.postMessage({ response: 'recordingStarted' }, '*');
|
||||
|
@ -79,7 +79,7 @@ export default injectIntl(withModalMounter(withTracker(({ intl, baseControls })
|
||||
}
|
||||
|
||||
// Check if user is removed out of the session
|
||||
Users.find({ userId: Auth.userID }).observeChanges({
|
||||
Users.find({ userId: Auth.userID }, { fields: { connectionId: 1, ejected: 1 }}).observeChanges({
|
||||
changed(id, fields) {
|
||||
const hasNewConnection = 'connectionId' in fields && (fields.connectionId !== Meteor.connection._lastSessionId);
|
||||
|
||||
|
@ -44,7 +44,7 @@ export default withTracker(() => {
|
||||
return hasUnreadMessages;
|
||||
};
|
||||
|
||||
Meetings.find({ meetingId: Auth.meetingID }).observeChanges({
|
||||
Meetings.find({ meetingId: Auth.meetingID }, { fields: { recordProp: 1 } }).observeChanges({
|
||||
changed: (id, fields) => {
|
||||
if (fields.recordProp && fields.recordProp.recording) {
|
||||
this.window.parent.postMessage({ response: 'recordingStarted' }, '*');
|
||||
|
@ -12,7 +12,7 @@ const UserListItemContainer = props => <UserListItem {...props} />;
|
||||
export default withTracker(({ userId }) => {
|
||||
const findUserInBreakout = Breakouts.findOne({ 'joinedUsers.userId': new RegExp(`^${userId}`) });
|
||||
const breakoutSequence = (findUserInBreakout || {}).sequence;
|
||||
const Meeting = Meetings.findOne({ MeetingId: Auth.meetingID });
|
||||
const Meeting = Meetings.findOne({ MeetingId: Auth.meetingID }, { fields: {meetingProp: 1}});
|
||||
return {
|
||||
user: mapUser(Users.findOne({ userId })),
|
||||
userInBreakout: !!findUserInBreakout,
|
||||
|
@ -187,7 +187,7 @@ WhiteboardMultiUser.find({ meetingId: Auth.meetingID }).observeChanges({
|
||||
changed: clearFakeAnnotations,
|
||||
});
|
||||
|
||||
Users.find({ userId: Auth.userID }).observeChanges({
|
||||
Users.find({ userId: Auth.userID }, { fields: { presenter: 1 } }).observeChanges({
|
||||
changed(id, { presenter }) {
|
||||
if (presenter === false) clearFakeAnnotations();
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user