Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove unused cursor code #19783

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions bbb-graphql-actions/src/actions/presentationPublishCursor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RedisMessage } from '../types';

export default function buildRedisMessage(sessionVariables: Record<string, unknown>, input: Record<string, unknown>): RedisMessage {
const eventName = `SendCursorPositionPubMsg`;

const routing = {
meetingId: sessionVariables['x-hasura-meetingid'] as String,
userId: sessionVariables['x-hasura-userid'] as String
};

const header = {
name: eventName,
meetingId: routing.meetingId,
userId: routing.userId
};

const body = {
whiteboardId: input.whiteboardId,
xPercent: input.xPercent,
yPercent: input.yPercent,
};

return { eventName, routing, header, body };
}
8 changes: 8 additions & 0 deletions bbb-graphql-server/metadata/actions.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,14 @@ type Mutation {
): Boolean
}

type Mutation {
presentationPublishCursor(
whiteboardId: String!
xPercent: Float!
yPercent: Float!
): Boolean
}

type Mutation {
presentationRemove(
presentationId: String!
Expand Down
6 changes: 6 additions & 0 deletions bbb-graphql-server/metadata/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,12 @@ actions:
permissions:
- role: bbb_client
comment: presentationExport
- name: presentationPublishCursor
definition:
kind: synchronous
handler: '{{HASURA_BBB_GRAPHQL_ACTIONS_ADAPTER_URL}}'
permissions:
- role: bbb_client
- name: presentationRemove
definition:
kind: synchronous
Expand Down
Empty file.
1 change: 0 additions & 1 deletion bigbluebutton-html5/imports/api/cursor/server/index.js

This file was deleted.

6 changes: 0 additions & 6 deletions bigbluebutton-html5/imports/api/cursor/server/methods.js

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ export const PRES_ANNOTATION_SUBMIT = gql`
}
`;

export const PRESENTATION_PUBLISH_CURSOR = gql`
mutation PresentationPublishCursor($whiteboardId: String!, $xPercent: Float!, $yPercent: Float!) {
presentationPublishCursor(
whiteboardId: $whiteboardId,
xPercent: $xPercent,
yPercent: $yPercent,
)
}
`;

export default {
PRESENTATION_SET_ZOOM,
PRESENTATION_SET_WRITERS,
Expand All @@ -100,4 +110,5 @@ export default {
PRESENTATION_REMOVE,
PRES_ANNOTATION_DELETE,
PRES_ANNOTATION_SUBMIT,
PRESENTATION_PUBLISH_CURSOR,
};
32 changes: 28 additions & 4 deletions bigbluebutton-html5/imports/ui/components/whiteboard/container.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
import React, { useEffect, useRef, useState } from 'react';
import React, {
useEffect,
useRef,
useState,
useMemo,
} from 'react';
import { useSubscription, useMutation } from '@apollo/client';
import {
AssetRecordType,
} from '@tldraw/tldraw';
import { throttle } from 'radash';
import {
CURRENT_PRESENTATION_PAGE_SUBSCRIPTION,
CURRENT_PAGE_ANNOTATIONS_STREAM,
CURRENT_PAGE_WRITERS_SUBSCRIPTION,
CURSOR_SUBSCRIPTION,
} from './queries';
import { CURSOR_SUBSCRIPTION } from './cursors/queries';
import {
initDefaultPages,
persistShape,
Expand All @@ -17,7 +23,6 @@ import {
toggleToolsAnimations,
formatAnnotations,
} from './service';
import CursorService from './cursors/service';
import SettingsService from '/imports/ui/services/settings';
import Auth from '/imports/ui/services/auth';
import {
Expand All @@ -35,6 +40,7 @@ import {
PRES_ANNOTATION_DELETE,
PRES_ANNOTATION_SUBMIT,
PRESENTATION_SET_PAGE,
PRESENTATION_PUBLISH_CURSOR,
} from '../presentation/mutations';

const WHITEBOARD_CONFIG = window.meetingClientSettings.public.whiteboard;
Expand Down Expand Up @@ -76,6 +82,7 @@ const WhiteboardContainer = (props) => {
const [presentationSetPage] = useMutation(PRESENTATION_SET_PAGE);
const [presentationDeleteAnnotations] = useMutation(PRES_ANNOTATION_DELETE);
const [presentationSubmitAnnotations] = useMutation(PRES_ANNOTATION_SUBMIT);
const [presentationPublishCursor] = useMutation(PRESENTATION_PUBLISH_CURSOR);

const setPresentationPage = (pageId) => {
presentationSetPage({
Expand Down Expand Up @@ -131,6 +138,23 @@ const WhiteboardContainer = (props) => {
persistShape(shape, whiteboardId, isModerator, submitAnnotations);
};

const publishCursorUpdate = (payload) => {
const { whiteboardId, xPercent, yPercent } = payload;

presentationPublishCursor({
variables: {
whiteboardId,
xPercent,
yPercent,
},
});
};

const throttledPublishCursorUpdate = useMemo(() => throttle(
{ interval: WHITEBOARD_CONFIG.cursorInterval },
publishCursorUpdate,
), []);

const isMultiUserActive = whiteboardWriters?.length > 0;

const { data: currentUser } = useCurrentUser((user) => ({
Expand Down Expand Up @@ -282,7 +306,7 @@ const WhiteboardContainer = (props) => {
}}
{...props}
meetingId={Auth.meetingID}
publishCursorUpdate={CursorService.publishCursorUpdate}
publishCursorUpdate={throttledPublishCursorUpdate}
otherCursors={cursorArray}
hideViewersCursor={meeting?.data?.lockSettings?.hideViewersCursor}
/>
Expand Down