2020-06-30 10:43:20 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import Auth from '/imports/ui/services/auth';
|
|
|
|
import Users from '/imports/api/users';
|
|
|
|
import Settings from '/imports/ui/services/settings';
|
|
|
|
import { makeCall } from '/imports/ui/services/api';
|
|
|
|
import StatusNotifier from './component';
|
|
|
|
|
2020-07-06 20:56:19 +08:00
|
|
|
const ROLE_VIEWER = Meteor.settings.public.user.role_viewer;
|
|
|
|
|
2020-06-30 10:43:20 +08:00
|
|
|
const StatusNotifierContainer = ({ ...props }) => <StatusNotifier {...props} />;
|
|
|
|
|
|
|
|
export default withTracker((props) => {
|
|
|
|
const AppSettings = Settings.application;
|
2020-07-06 20:56:19 +08:00
|
|
|
const currentUser = Users.findOne({ userId: Auth.userID }, { fields: { userId: 1, role: 1 } });
|
2020-06-30 10:43:20 +08:00
|
|
|
const { status } = props;
|
|
|
|
const emojiUsers = Users.find({ meetingId: Auth.meetingID, emoji: status }, {
|
|
|
|
fields: {
|
|
|
|
emojiTime: 1, emoji: 1, userId: 1, name: 1, color: 1,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
.fetch()
|
|
|
|
.filter(u => u.emoji === status && u.userId !== currentUser.userId);
|
|
|
|
const clearUserStatus = userId => makeCall('setEmojiStatus', userId, 'none');
|
|
|
|
|
|
|
|
return {
|
2020-07-06 20:56:19 +08:00
|
|
|
isViewer: currentUser.role === ROLE_VIEWER,
|
2020-06-30 10:43:20 +08:00
|
|
|
clearUserStatus,
|
|
|
|
emojiUsers,
|
|
|
|
status,
|
|
|
|
raiseHandAudioAlert: AppSettings.raiseHandAudioAlerts,
|
|
|
|
raiseHandPushAlert: AppSettings.raiseHandPushAlerts,
|
|
|
|
};
|
|
|
|
})(StatusNotifierContainer);
|