diff --git a/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-typing-indicator/component.tsx b/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-typing-indicator/component.tsx index 9b8a6b68b2..ae94e0501b 100644 --- a/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-typing-indicator/component.tsx +++ b/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-typing-indicator/component.tsx @@ -2,7 +2,8 @@ import React from 'react'; import { Meteor } from 'meteor/meteor'; import { useSubscription } from '@apollo/client'; import { - IS_TYPING_SUBSCRIPTION, + IS_TYPING_PUBLIC_SUBSCRIPTION, + IS_TYPING_PRIVATE_SUBSCRIPTION, } from '../queries'; import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { User } from '/imports/ui/Types/user'; @@ -99,18 +100,22 @@ const TypingIndicator: React.FC = ({ ); }; -const TypingIndicatorContainer: React.FC = ({ userId, isTypingTo, error }) => { +const TypingIndicatorContainer: React.FC = ({ userId, isTypingTo, isPrivate, error }) => { const intl = useIntl(); const { data: typingUsersData, - } = useSubscription(IS_TYPING_SUBSCRIPTION, { + } = useSubscription(isPrivate ? IS_TYPING_PRIVATE_SUBSCRIPTION : IS_TYPING_PUBLIC_SUBSCRIPTION, { variables: { chatId: isTypingTo, } }); - const typingUsers = typingUsersData?.user_typing_public || []; + const publicTypingUsers = typingUsersData?.user_typing_public || []; + const privateTypingUsers = typingUsersData?.user_typing_private || []; + + const typingUsers = privateTypingUsers.concat(publicTypingUsers); + const typingUsersArray = typingUsers .filter(user => user?.userId !== userId) .map(user => user.user); diff --git a/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/queries.ts b/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/queries.ts index bfd2d53618..0f56980a84 100644 --- a/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/queries.ts +++ b/bigbluebutton-html5/imports/ui/components/chat/chat-graphql/queries.ts @@ -1,6 +1,6 @@ import { gql } from '@apollo/client'; -export const IS_TYPING_SUBSCRIPTION = gql`subscription IsTyping($chatId: String!) { +export const IS_TYPING_PUBLIC_SUBSCRIPTION = gql`subscription IsTyping($chatId: String!) { user_typing_public( limit: 4, where: { @@ -19,6 +19,26 @@ export const IS_TYPING_SUBSCRIPTION = gql`subscription IsTyping($chatId: String! } }`; +export const IS_TYPING_PRIVATE_SUBSCRIPTION = gql`subscription IsTyping($chatId: String!) { + user_typing_private( + limit: 4, + where: { + isCurrentlyTyping: {_eq: true} + chatId: {_eq: $chatId} + } + ) { + meetingId + chatId + userId + typingAt + isCurrentlyTyping + user { + name + } + } +}`; + export default { - IS_TYPING_SUBSCRIPTION, + IS_TYPING_PUBLIC_SUBSCRIPTION, + IS_TYPING_PRIVATE_SUBSCRIPTION, }; diff --git a/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx b/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx index 0b99ab3aff..1f5cb5cc6d 100755 --- a/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/chat/message-form/component.jsx @@ -376,7 +376,8 @@ class MessageForm extends PureComponent {