remove userActivitySign makecall + fix inactivity check
This commit is contained in:
parent
8091d99cee
commit
16ba97ffb1
@ -1,10 +1,8 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import setUserEffectiveConnectionType from './methods/setUserEffectiveConnectionType';
|
||||
import userActivitySign from './methods/userActivitySign';
|
||||
import validateConnection from './methods/validateConnection';
|
||||
|
||||
Meteor.methods({
|
||||
validateConnection,
|
||||
setUserEffectiveConnectionType,
|
||||
userActivitySign,
|
||||
});
|
||||
|
@ -1,40 +0,0 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import Users from '/imports/api/users';
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { extractCredentials } from '/imports/api/common/server/helpers';
|
||||
import { check } from 'meteor/check';
|
||||
|
||||
export default async function userActivitySign() {
|
||||
try {
|
||||
const REDIS_CONFIG = Meteor.settings.private.redis;
|
||||
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
||||
const EVENT_NAME = 'UserActivitySignCmdMsg';
|
||||
const { meetingId, requesterUserId: userId } = extractCredentials(this.userId);
|
||||
|
||||
check(meetingId, String);
|
||||
check(userId, String);
|
||||
|
||||
const payload = {
|
||||
userId,
|
||||
};
|
||||
|
||||
const selector = {
|
||||
userId,
|
||||
};
|
||||
|
||||
const modifier = {
|
||||
$set: {
|
||||
inactivityCheck: false,
|
||||
},
|
||||
};
|
||||
|
||||
await Users.updateAsync(selector, modifier); // TODO-- we should move this to a modifier
|
||||
|
||||
Logger.info(`User ${userId} sent a activity sign for meeting ${meetingId}`);
|
||||
|
||||
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
|
||||
} catch (err) {
|
||||
Logger.error(`Exception while invoking method userActivitySign ${err.stack}`);
|
||||
}
|
||||
}
|
@ -4,9 +4,6 @@ import { defineMessages } from 'react-intl';
|
||||
|
||||
import Button from '/imports/ui/components/common/button/component';
|
||||
import ModalSimple from '/imports/ui/components/common/modal/simple/component';
|
||||
import { makeCall } from '/imports/ui/services/api';
|
||||
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import Styled from './styles';
|
||||
|
||||
const propTypes = {
|
||||
@ -31,8 +28,6 @@ const intlMessages = defineMessages({
|
||||
},
|
||||
});
|
||||
|
||||
const handleInactivityDismiss = () => makeCall('userActivitySign');
|
||||
|
||||
class ActivityCheck extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
@ -87,14 +82,14 @@ class ActivityCheck extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { intl } = this.props;
|
||||
const { intl, userActivitySign } = this.props;
|
||||
|
||||
const { responseDelay } = this.state;
|
||||
|
||||
return (
|
||||
<ModalSimple
|
||||
hideBorder
|
||||
onRequestClose={handleInactivityDismiss}
|
||||
onRequestClose={() => userActivitySign()}
|
||||
shouldCloseOnOverlayClick={false}
|
||||
shouldShowCloseButton={false}
|
||||
priority="high"
|
||||
@ -107,7 +102,7 @@ class ActivityCheck extends Component {
|
||||
color="primary"
|
||||
disabled={responseDelay <= 0}
|
||||
label={intl.formatMessage(intlMessages.activityCheckButton)}
|
||||
onClick={handleInactivityDismiss}
|
||||
onClick={() => userActivitySign()}
|
||||
role="button"
|
||||
size="lg"
|
||||
/>
|
||||
|
@ -1,7 +1,13 @@
|
||||
import React from 'react';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import { useMutation } from '@apollo/client';
|
||||
import ActivityCheck from './component';
|
||||
import { USER_SEND_ACTIVITY_SIGN } from './mutations';
|
||||
|
||||
const ActivityCheckContainer = (props) => <ActivityCheck {...props} />;
|
||||
const ActivityCheckContainer = (props) => {
|
||||
const [userActivitySign] = useMutation(USER_SEND_ACTIVITY_SIGN);
|
||||
|
||||
return <ActivityCheck userActivitySign={userActivitySign} {...props} />;
|
||||
};
|
||||
|
||||
export default injectIntl(ActivityCheckContainer);
|
||||
|
@ -0,0 +1,9 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const USER_SEND_ACTIVITY_SIGN = gql`
|
||||
mutation UserSendActivitySign {
|
||||
userSendActivitySign
|
||||
}
|
||||
`;
|
||||
|
||||
export default { USER_SEND_ACTIVITY_SIGN };
|
@ -439,9 +439,7 @@ class App extends Component {
|
||||
}
|
||||
|
||||
renderActivityCheck() {
|
||||
const { User } = this.props;
|
||||
|
||||
const { inactivityWarningDisplay, inactivityWarningTimeoutSecs } = User;
|
||||
const { inactivityWarningDisplay, inactivityWarningTimeoutSecs } = this.props;
|
||||
|
||||
return (inactivityWarningDisplay ? (
|
||||
<ActivityCheckContainer
|
||||
|
@ -102,10 +102,14 @@ const AppContainer = (props) => {
|
||||
isModerator: user.isModerator,
|
||||
presenter: user.presenter,
|
||||
speechLocale: user.speechLocale,
|
||||
inactivityWarningDisplay: user.inactivityWarningDisplay,
|
||||
inactivityWarningTimeoutSecs: user.inactivityWarningTimeoutSecs,
|
||||
}));
|
||||
|
||||
const isModerator = currentUserData?.isModerator;
|
||||
const isPresenter = currentUserData?.presenter;
|
||||
const inactivityWarningDisplay = currentUserData?.inactivityWarningDisplay;
|
||||
const inactivityWarningTimeoutSecs = currentUserData?.inactivityWarningTimeoutSecs;
|
||||
|
||||
const { sidebarContentPanel, isOpen: sidebarContentIsOpen } = sidebarContent;
|
||||
const { sidebarNavPanel, isOpen: sidebarNavigationIsOpen } = sidebarNavigation;
|
||||
@ -235,6 +239,8 @@ const AppContainer = (props) => {
|
||||
setLocalSettings,
|
||||
genericComponentId: genericComponent.genericComponentId,
|
||||
audioCaptions: <AudioCaptionsLiveContainer speechLocale={currentUserData?.speechLocale} />,
|
||||
inactivityWarningDisplay,
|
||||
inactivityWarningTimeoutSecs,
|
||||
}}
|
||||
{...otherProps}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user