migrate changeRaiseHand meteor call
This commit is contained in:
parent
cb1d20a8ea
commit
be300d37d2
@ -3,7 +3,6 @@ import validateAuthToken from './methods/validateAuthToken';
|
||||
import setSpeechLocale from './methods/setSpeechLocale';
|
||||
import setMobileUser from './methods/setMobileUser';
|
||||
import setEmojiStatus from './methods/setEmojiStatus';
|
||||
import changeRaiseHand from './methods/changeRaiseHand';
|
||||
import assignPresenter from './methods/assignPresenter';
|
||||
import removeUser from './methods/removeUser';
|
||||
import toggleUserLock from './methods/toggleUserLock';
|
||||
@ -19,7 +18,6 @@ Meteor.methods({
|
||||
setMobileUser,
|
||||
setEmojiStatus,
|
||||
clearAllUsersEmoji,
|
||||
changeRaiseHand,
|
||||
assignPresenter,
|
||||
removeUser,
|
||||
validateAuthToken,
|
||||
|
@ -1,31 +0,0 @@
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
|
||||
export default async function changeRaiseHand(raiseHand, userId = undefined) {
|
||||
try {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'ChangeUserRaiseHandReqMsg';
|
||||
|
||||
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(raiseHand, Boolean);
|
||||
|
||||
const payload = {
|
||||
userId: userId || requesterUserId,
|
||||
raiseHand,
|
||||
};
|
||||
|
||||
Logger.verbose('Updated raiseHand status for user', {
|
||||
meetingId, requesterUserId, raiseHand,
|
||||
});
|
||||
|
||||
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
||||
} catch (err) {
|
||||
Logger.error(`Exception while invoking method changeRaiseHand ${err.stack}`);
|
||||
}
|
||||
}
|
@ -3,11 +3,12 @@ import { defineMessages } from 'react-intl';
|
||||
import PropTypes from 'prop-types';
|
||||
import BBBMenu from '/imports/ui/components/common/menu/component';
|
||||
import UserReactionService from '/imports/ui/components/user-reaction/service';
|
||||
import UserListService from '/imports/ui/components/user-list/service';
|
||||
import { convertRemToPixels } from '/imports/utils/dom-utils';
|
||||
import data from '@emoji-mart/data';
|
||||
import withShortcutHelper from '/imports/ui/components/shortcut-help/service';
|
||||
import { init } from 'emoji-mart';
|
||||
import { SET_RAISE_HAND } from '/imports/ui/core/graphql/mutations/userMutations';
|
||||
import { useMutation } from '@apollo/client';
|
||||
|
||||
import Styled from './styles';
|
||||
|
||||
@ -28,6 +29,8 @@ const ReactionsButton = (props) => {
|
||||
// initialize emoji-mart data, need for the new version
|
||||
init({ data });
|
||||
|
||||
const [setRaiseHand] = useMutation(SET_RAISE_HAND);
|
||||
|
||||
const [showEmojiPicker, setShowEmojiPicker] = useState(false);
|
||||
|
||||
const intlMessages = defineMessages({
|
||||
@ -58,7 +61,12 @@ const ReactionsButton = (props) => {
|
||||
};
|
||||
|
||||
const handleRaiseHandButtonClick = () => {
|
||||
UserListService.setUserRaiseHand(userId, !raiseHand);
|
||||
setRaiseHand({
|
||||
variables: {
|
||||
userId,
|
||||
raiseHand: !raiseHand,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
const RaiseHandButtonLabel = () => {
|
||||
|
@ -4,8 +4,9 @@ import Auth from '/imports/ui/services/auth';
|
||||
import Users from '/imports/api/users';
|
||||
import Settings from '/imports/ui/services/settings';
|
||||
import { UsersContext } from '/imports/ui/components/components-data/users-context/context';
|
||||
import { makeCall } from '/imports/ui/services/api';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import RaiseHandNotifier from './component';
|
||||
import { SET_RAISE_HAND } from '/imports/ui/core/graphql/mutations/userMutations';
|
||||
|
||||
const ROLE_VIEWER = Meteor.settings.public.user.role_viewer;
|
||||
|
||||
@ -15,11 +16,24 @@ const StatusNotifierContainer = (props) => {
|
||||
const currentUser = users[Auth.meetingID][Auth.userID];
|
||||
const isViewer = currentUser.role === ROLE_VIEWER;
|
||||
const isPresenter = currentUser.presenter;
|
||||
|
||||
const [setRaiseHand] = useMutation(SET_RAISE_HAND);
|
||||
|
||||
const lowerUserHands = (userId) => {
|
||||
setRaiseHand({
|
||||
variables: {
|
||||
userId,
|
||||
raiseHand: false,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<RaiseHandNotifier {...{
|
||||
...props,
|
||||
isViewer,
|
||||
isPresenter,
|
||||
lowerUserHands,
|
||||
}}
|
||||
/>
|
||||
);
|
||||
@ -36,10 +50,8 @@ export default withTracker(() => {
|
||||
},
|
||||
sort: { raiseHandTime: 1 },
|
||||
}).fetch();
|
||||
const lowerUserHands = (userId) => makeCall('changeRaiseHand', false, userId);
|
||||
|
||||
return {
|
||||
lowerUserHands,
|
||||
raiseHandUsers,
|
||||
raiseHandAudioAlert: AppSettings.raiseHandAudioAlerts,
|
||||
raiseHandPushAlert: AppSettings.raiseHandPushAlerts,
|
||||
|
@ -489,10 +489,6 @@ const setEmojiStatus = throttle({ interval: 1000 }, (userId, emoji) => {
|
||||
: makeCall('setEmojiStatus', userId, 'none');
|
||||
});
|
||||
|
||||
const setUserRaiseHand = throttle({ interval: 1000 }, (userId, raiseHand) => {
|
||||
return makeCall('changeRaiseHand', raiseHand);
|
||||
}, 250, { leading: false, trailing: true });
|
||||
|
||||
const clearAllEmojiStatus = () => {
|
||||
makeCall('clearAllUsersEmoji');
|
||||
};
|
||||
@ -738,7 +734,6 @@ export default {
|
||||
sortUsersByName,
|
||||
sortUsers,
|
||||
setEmojiStatus,
|
||||
setUserRaiseHand,
|
||||
clearAllEmojiStatus,
|
||||
clearAllReactions,
|
||||
assignPresenter,
|
||||
|
@ -9,4 +9,13 @@ export const SET_CAMERA_PINNED = gql`
|
||||
}
|
||||
`;
|
||||
|
||||
export default { SET_CAMERA_PINNED };
|
||||
export const SET_RAISE_HAND = gql`
|
||||
mutation SetRaiseHand($userId: String!, $raiseHand: Boolean!) {
|
||||
userSetRaiseHand(
|
||||
userId: $userId,
|
||||
raiseHand: $raiseHand,
|
||||
)
|
||||
}
|
||||
`;
|
||||
|
||||
export default { SET_CAMERA_PINNED, SET_RAISE_HAND };
|
||||
|
Loading…
Reference in New Issue
Block a user