Skip to content

feat(chat): message reactions - #21385

Merged
ramonlsouza merged 4 commits into
bigbluebutton:v3.0.x-releasefrom
JoVictorNunes:chat-message-reactions
Oct 16, 2024
Merged

ramonlsouza merged 4 commits into
bigbluebutton:v3.0.x-releasefrom
JoVictorNunes:chat-message-reactions

Conversation

@JoVictorNunes

Copy link
Copy Markdown
Contributor

What does this PR do?

Add ability to react to chat messages.

Screencast.from.07-10-2024.14.04.38.webm

Closes Issue(s)

Closes n/a

More

This PR was built on top of #21355, that's why I am opening it as draft (until #21355 is merged).

@coderabbitai

This comment was marked as off-topic.

@JoVictorNunes
JoVictorNunes marked this pull request as draft October 7, 2024 17:21

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 38

🧹 Outside diff range and nitpick comments (45)
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-form/mutations.tsx (1)

5-10: LGTM! Consider adding a comment for the new parameter.

The addition of the replyToMessageId parameter to the ChatSendMessage mutation is well-implemented and aligns with the PR objectives. It allows for the implementation of a reply feature while maintaining backward compatibility.

Consider adding a brief comment explaining the purpose of the replyToMessageId parameter for better code documentation. For example:

 mutation ChatSendMessage($chatId: String!, $chatMessageInMarkdownFormat: String!, $replyToMessageId: String) {
   chatSendMessage(
     chatId: $chatId,
     chatMessageInMarkdownFormat: $chatMessageInMarkdownFormat,
+    # Optional ID of the message being replied to
     replyToMessageId: $replyToMessageId
   )
 }
bigbluebutton-html5/imports/ui/core/enums/chat.ts (1)

3-6: LGTM! Consider adding brief comments for each new constant.

The new constants in the ChatEvents enum are well-named and consistent with the existing code style. They clearly represent new chat-related events, which aligns with the PR's objective of enhancing chat functionality.

To improve maintainability, consider adding brief comments for each new constant to explain their specific use cases. For example:

// Request to focus on a specific message in the chat
CHAT_FOCUS_MESSAGE_REQUEST = 'ChatFocusMessageRequest',

// Indicates user's intention to reply to a message
CHAT_REPLY_INTENTION = 'ChatReplyIntention',

// Request to edit an existing chat message
CHAT_EDIT_REQUEST = 'ChatEditRequest',

// Request to delete a chat message
CHAT_DELETE_REQUEST = 'ChatDeleteRequest',
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-reactions/styles.ts (2)

4-22: LGTM: Well-structured EmojiWrapper component with a minor suggestion.

The EmojiWrapper component is well-designed, using appropriate styling and conditional rendering based on the highlighted prop. The hover effect enhances user interaction.

Consider adding an aria-label or title attribute to improve accessibility, especially if the button contains only an emoji. This will help screen readers understand the button's purpose. For example:

-const EmojiWrapper = styled.button<{ highlighted: boolean }>`
+const EmojiWrapper = styled.button.attrs<{ highlighted: boolean }>(props => ({
+  'aria-label': `React with emoji ${props['aria-label'] || ''}`,
+}))<{ highlighted: boolean }>`
  // ... rest of the styling
`;

This change allows you to provide a specific label for each emoji when using the component.


29-32: LGTM: Export statement is correct, with a minor suggestion.

The export statement correctly includes both EmojiWrapper and ReactionsWrapper components.

Consider using named exports instead of a default export for better tree-shaking and module resolution in some bundlers. Here's an alternative approach:

-export default {
-  EmojiWrapper,
-  ReactionsWrapper,
-};
+export { EmojiWrapper, ReactionsWrapper };

This change allows for more efficient imports in other files:

import { EmojiWrapper, ReactionsWrapper } from './styles';

It also enables better tree-shaking, as unused components can be easily eliminated by the bundler.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-content/text-content/component.tsx (2)

9-9: LGTM! Consider renaming the property for clarity.

The addition of the dataTest property enhances the testability of the component. The optional string | null type is appropriate and maintains backward compatibility.

Consider renaming dataTest to dataTestId for improved clarity on its purpose. This naming convention is commonly used in testing libraries and frameworks.


20-20: LGTM! Consider adding a fallback for null values.

The update to use the dataTest prop in the data-test attribute improves the component's flexibility. This change is consistent with the updates to the component's interface and props.

Consider adding a fallback for when dataTest is null to ensure a valid data-test attribute is always present:

-<Styled.ChatMessage systemMsg={systemMsg} emphasizedMessage={emphasizedMessage} data-test={dataTest}>
+<Styled.ChatMessage systemMsg={systemMsg} emphasizedMessage={emphasizedMessage} data-test={dataTest || 'messageContent'}>

This ensures that even if null is passed, the default value 'messageContent' will be used.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-edit-form/styles.ts (3)

6-10: LGTM: Actions component is well-defined.

The 'Actions' styled component is appropriately designed for right-aligned action elements. The use of flexbox ensures proper alignment.

Consider using a variable for the padding value (e.g., ${borderSize}) to maintain consistency with other parts of the application:

const Actions = styled.div`
  display: flex;
  justify-content: flex-end;
-  padding-top: 8px;
+  padding-top: ${borderSize};
`;

12-16: LGTM: Section component uses conditional styling effectively.

The 'Section' styled component makes good use of TypeScript props and conditional styling to differentiate messages from the same sender.

Consider extracting the margin value to a constant or importing it from a common styles file for better maintainability:

+ import { messageMargin } from '/imports/ui/stylesheets/styled-components/chat';

const Section = styled.section<{ $sameSender: boolean }>`
  ${({ $sameSender }) => $sameSender && `
-    margin-left: 2.6rem;
+    margin-left: ${messageMargin};
  `}
`;

18-34: LGTM: ChatMessageError component and exports are well-defined.

The 'ChatMessageError' styled component is appropriately styled for error message display, using imported style variables for consistency. The export makes all components available for use in other parts of the application.

There's a minor inconsistency in the color definition:

const ChatMessageError = styled.div`
  color: ${colorDanger};
  font-size: calc(${fontSizeBase} * .75);
- color: ${colorGrayDark};
  text-align: left;
  padding: ${borderSize} 0;
  word-break: break-word;
  position: relative;
  margin-right: 0.05rem;
  margin-left: 0.05rem;
`;

The color property is defined twice, with the second definition overriding the first. Remove the redundant color: ${colorDanger}; line to avoid confusion.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-replied/styles.tsx (3)

4-13: LGTM: Container component is well-structured. Consider adding hover effect.

The Container component is well-defined with appropriate styling for a chat message. It correctly uses the $userColor prop for the left border, providing visual distinction. The use of colorOffWhite from the imported palette ensures consistency with the overall design system.

Consider adding a subtle hover effect to enhance the interactivity cue, given that the cursor is set to 'pointer'. For example:

 const Container = styled.div<{ $userColor: string }>`
   /* ... existing styles ... */
   cursor: pointer;
+  transition: background-color 0.2s ease;
+  &:hover {
+    background-color: ${colorOffWhite}ee;
+  }
 `;

This change would provide visual feedback when users hover over the message, improving the user experience.


19-26: LGTM: Username component is well-styled. Consider adding a fallback color.

The Username component extends Typography appropriately and adds specific styling for usernames in the chat context. The use of $userColor for the text color ensures visual consistency with the Container's left border.

Consider adding a fallback color in case $userColor is not provided or is invalid. This can improve the component's robustness:

 const Username = styled(Typography)<{ $userColor: string }>`
   font-weight: bold;
-  color: ${({ $userColor }) => $userColor};
+  color: ${({ $userColor }) => $userColor || colorText};
   /* ... other styles ... */
 `;

This change ensures that the username will always have a readable color, even if there's an issue with the provided $userColor.


28-32: LGTM: Message component handles long content well. Consider adding ellipsis for truncated text.

The Message component extends Typography appropriately and adds specific styling to handle message content. The max-height and overflow handling effectively prevent long messages from disrupting the layout.

To improve user experience, consider adding an ellipsis for truncated text. This will indicate to users that there's more content:

 const Message = styled(Typography)`
   max-height: 3.6rem;
   line-height: 1.2rem;
-  overflow: hidden;
+  overflow: hidden;
+  display: -webkit-box;
+  -webkit-line-clamp: 3;
+  -webkit-box-orient: vertical;
+  text-overflow: ellipsis;
 `;

This change will display an ellipsis (...) at the end of the third line if the message content exceeds the max-height, providing a visual cue that there's more content to be seen.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-header/component.tsx (2)

17-17: LGTM! Consider adding a brief comment for clarity.

The addition of the deleteTime property to the ChatMessageHeaderProps interface is appropriate and well-typed. It correctly allows for the possibility of a message being deleted or not.

Consider adding a brief comment to explain the purpose of this property, for example:

/** Timestamp when the message was deleted, or null if not deleted */
deleteTime: Date | null;

43-47: LGTM! Consider adjusting indentation for better readability.

The new conditional rendering logic correctly implements the requirement to hide the message time when the message has been deleted. The condition !deleteTime appropriately handles both null and undefined cases.

Consider adjusting the indentation of the new block to improve readability:

{!deleteTime && (
  <Styled.ChatTime>
    <FormattedTime value={dateTime} />
  </Styled.ChatTime>
)}
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/mutations.ts (5)

3-7: LGTM with a suggestion: Consider specifying the return type.

The CHAT_EDIT_MESSAGE_MUTATION is well-defined with proper parameter types. However, for improved type safety, consider specifying the return type of the mutation.

You could modify the mutation as follows:

 const CHAT_EDIT_MESSAGE_MUTATION = gql`
-  mutation($chatId: String!, $messageId: String!, $chatMessageInMarkdownFormat: String!) {
+  mutation($chatId: String!, $messageId: String!, $chatMessageInMarkdownFormat: String!): Boolean {
     chatEditMessage(chatId: $chatId, messageId: $messageId, chatMessageInMarkdownFormat: $chatMessageInMarkdownFormat)
   }
 `;

This assumes the mutation returns a boolean indicating success. Adjust the return type if it's different.


9-13: LGTM with a suggestion: Consider specifying the return type.

The CHAT_DELETE_MESSAGE_MUTATION is well-defined with proper parameter types. However, for improved type safety, consider specifying the return type of the mutation.

You could modify the mutation as follows:

 const CHAT_DELETE_MESSAGE_MUTATION = gql`
-  mutation($chatId: String!, $messageId: String!) {
+  mutation($chatId: String!, $messageId: String!): Boolean {
     chatDeleteMessage(chatId: $chatId, messageId: $messageId)
   }
 `;

This assumes the mutation returns a boolean indicating success. Adjust the return type if it's different.


15-19: LGTM with a suggestion: Consider specifying the return type.

The CHAT_SEND_REACTION_MUTATION is well-defined with proper parameter types. However, for improved type safety, consider specifying the return type of the mutation.

You could modify the mutation as follows:

 const CHAT_SEND_REACTION_MUTATION = gql`
-  mutation($chatId: String!, $messageId: String!, $reactionEmoji: String!) {
+  mutation($chatId: String!, $messageId: String!, $reactionEmoji: String!): Boolean {
     chatSendMessageReaction(chatId: $chatId, messageId: $messageId, reactionEmoji: $reactionEmoji)
   }
 `;

This assumes the mutation returns a boolean indicating success. Adjust the return type if it's different.


21-25: LGTM with a suggestion: Consider specifying the return type.

The CHAT_DELETE_REACTION_MUTATION is well-defined with proper parameter types. However, for improved type safety, consider specifying the return type of the mutation.

You could modify the mutation as follows:

 const CHAT_DELETE_REACTION_MUTATION = gql`
-  mutation($chatId: String!, $messageId: String!, $reactionEmoji: String!) {
+  mutation($chatId: String!, $messageId: String!, $reactionEmoji: String!): Boolean {
     chatDeleteMessageReaction(chatId: $chatId, messageId: $messageId, reactionEmoji: $reactionEmoji)
   }
 `;

This assumes the mutation returns a boolean indicating success. Adjust the return type if it's different.


27-39: LGTM with a minor suggestion: Consider maintaining consistent ordering.

The export statements are correct and provide flexibility for different import scenarios. Both default and named exports include all defined mutations.

For improved readability and maintenance, consider maintaining a consistent order of mutations across their definitions, default export object, and named exports. For example:

export default {
  CHAT_EDIT_MESSAGE_MUTATION,
  CHAT_DELETE_MESSAGE_MUTATION,
  CHAT_SEND_REACTION_MUTATION,
  CHAT_DELETE_REACTION_MUTATION,
};

export {
  CHAT_EDIT_MESSAGE_MUTATION,
  CHAT_DELETE_MESSAGE_MUTATION,
  CHAT_SEND_REACTION_MUTATION,
  CHAT_DELETE_REACTION_MUTATION,
};
bigbluebutton-html5/imports/ui/services/storage/hooks.ts (1)

61-61: Consider standardizing export pattern

Adding STORAGES to the default export is consistent with the existing pattern in this file. However, having both named and default exports for the same items can sometimes lead to inconsistent import styles across the codebase.

Consider standardizing on either named exports or a default export throughout the codebase for consistency. If you choose to keep both, ensure that the team agrees on when to use each style of import.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-reply-intention/styles.tsx (3)

8-32: LGTM: Well-structured Container component with responsive design.

The Container styled component is well-implemented with appropriate use of props for conditional styling. The responsive design and animation considerations are good practices.

Consider extracting the magic numbers (e.g., 6rem, 0.75rem) into named constants for better maintainability. For example:

const CONTAINER_HEIGHT = '6rem';
const CONTAINER_MARGIN_RIGHT = '0.75rem';

42-48: LGTM: Username component extends Typography well.

The Username styled component appropriately extends Typography and uses a color constant for consistency.

Consider making the height and line-height more flexible to accommodate different font sizes or multilingual support. You could use em units instead of rem for these properties:

const Username = styled(Typography)`
  font-weight: bold;
  color: ${colorBlueLight};
  line-height: 1em;
  height: 1em;
  font-size: 1rem;
`;

50-54: LGTM: Message component uses dynamic sizing.

The Message styled component uses calc() for dynamic sizing, which is a good practice. The comment explaining the calculation is helpful for maintainability.

Consider using CSS custom properties (variables) to make the calculation more maintainable and less prone to errors if other components change:

const Message = styled.div`
  --container-height: 6rem;
  --username-height: 1rem;
  --vertical-padding: 12px;
  max-height: calc(var(--container-height) - var(--username-height) - var(--vertical-padding));
  overflow: hidden;
`;

This approach allows for easier updates if any of these values change in the future.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-replied/component.tsx (2)

15-22: LGTM: Well-defined interface with appropriate types.

The MessageRepliedProps interface is well-structured and includes all necessary props for the component. The use of TypeScript for type checking is a good practice.

Consider adding JSDoc comments to describe the purpose of each prop, especially for less obvious ones like emphasizedMessage and sequence. This would improve code documentation and maintainability.


31-63: LGTM with suggestions: Well-structured render logic with room for improvement.

The component's render logic is well-structured and handles different scenarios appropriately. The use of styled components for styling is good, and the conditional rendering based on message deletion status is implemented correctly.

Consider the following improvements:

  1. Extract the click handler logic into a separate function for better readability and testability:
const handleMessageClick = useCallback(() => {
  window.dispatchEvent(
    new CustomEvent(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST, {
      detail: { sequence },
    })
  );
  Storage.removeItem(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST);
  Storage.setItem(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST, sequence);
}, [sequence]);
  1. Use a useEffect hook to handle side effects related to storage:
useEffect(() => {
  const handleFocusRequest = () => {
    Storage.removeItem(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST);
    Storage.setItem(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST, sequence);
  };
  
  window.addEventListener(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST, handleFocusRequest);
  
  return () => {
    window.removeEventListener(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST, handleFocusRequest);
  };
}, [sequence]);

These changes would improve the component's adherence to React best practices and make it more maintainable.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-toolbar/styles.ts (2)

11-42: Consider adding a comment to explain the sequence-based positioning logic.

The Container component is well-structured with appropriate use of props for conditional styling. However, the positioning logic based on the $sequence prop (lines 33-41) is a bit complex and might benefit from a brief comment explaining its purpose and how it affects the toolbar's position.

Consider adding a comment like this before the sequence-based styling:

// Position the toolbar at the bottom for the first message in a sequence,
// and at the top for subsequent messages
${({ $sequence }) => (($sequence === 1)
  ? css`
    bottom: 0;
    transform: translateY(50%);
  `
  : css`
    top: 0;
    transform: translateY(-50%);
  `)}

44-71: Review the use of !important flags in CSS rules.

The EmojiPickerWrapper component provides appropriate styling for the emoji picker. However, there are several instances of !important flags used in the CSS rules (lines 54, 62, 67, 68). While these may be necessary due to specificity issues with the emoji-mart library, it's generally a good practice to avoid !important when possible.

Consider reviewing these styles to see if the !important flags can be removed without breaking the layout. If they are indeed necessary, it might be helpful to add a comment explaining why they're required.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-reply-intention/component.tsx (2)

15-30: LGTM: Event handling is well-implemented, with a minor suggestion for improvement.

The useEffect hook is correctly used to set up and clean up the event listener for ChatEvents.CHAT_REPLY_INTENTION. The event handler properly updates all relevant state variables based on the event's details. The empty dependency array is appropriate as the effect doesn't depend on any variables.

For improved type safety, consider using a type assertion for the CustomEvent:

const handler = (e: Event) => {
  if (e instanceof CustomEvent<{username: string; message: string; emphasizedMessage: boolean; sequence: number}>) {
    setUsername(e.detail.username);
    setMessage(e.detail.message);
    setEmphasizedMessage(e.detail.emphasizedMessage);
    setSequence(e.detail.sequence);
  }
};

This will ensure that the detail object has the expected structure.


36-73: LGTM: Render logic is well-structured, with suggestions for improvement.

The component's render logic is well-implemented with appropriate conditional rendering based on the presence of username and message. The use of the ChatMessageTextContent component for displaying the message content ensures consistency with other parts of the application.

Consider the following improvements:

  1. Extract the onClick handler logic into a separate function for better readability:
const handleContainerClick = () => {
  window.dispatchEvent(
    new CustomEvent(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST, {
      detail: { sequence },
    })
  );
  Storage.removeItem(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST);
  if (sequence) Storage.setItem(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST, sequence);
};
  1. Move the storage management logic into a separate useEffect or custom hook to keep the render function pure:
useEffect(() => {
  if (sequence) {
    Storage.setItem(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST, sequence);
    return () => Storage.removeItem(ChatEvents.CHAT_FOCUS_MESSAGE_REQUEST);
  }
}, [sequence]);

These changes will improve the separation of concerns and make the component easier to maintain.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/component.tsx (1)

Line range hint 46-53: LGTM: New ChatLoading component with minor suggestion

The new ChatLoading component is a good addition, providing a visual indicator during the loading state. It correctly uses the ChatProps interface and maintains consistency with the main Chat component by using the same Styled.Chat wrapper with isRTL and isChrome props.

Consider moving the inline style for the CircularProgress component to the Styled.Chat component or a separate styled component for better maintainability. For example:

const StyledCircularProgress = styled(CircularProgress)`
  align-self: center;
`;

// Then in the component:
<StyledCircularProgress />

This approach would keep all styling concerns in one place and make it easier to modify in the future if needed.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-reactions/component.tsx (2)

22-33: LGTM: Well-defined props interface with a minor suggestion.

The ChatMessageReactionsProps interface is well-structured and provides good type safety. The reaction object and function props are clearly defined.

Consider using a separate interface for the reaction object to improve reusability:

interface Reaction {
  createdAt: string;
  reactionEmoji: string;
  user: {
    name: string;
    userId: string;
  };
}

interface ChatMessageReactionsProps {
  reactions: Reaction[];
  sendReaction(reactionEmoji: string): void;
  deleteReaction(reactionEmoji: string): void;
}

35-58: LGTM: Efficient data processing with a performance optimization suggestion.

The component initialization and data processing logic are well-implemented. The use of React.FC and the custom useCurrentUser hook demonstrates good React practices.

Consider memoizing the reactionItems object to optimize performance, especially if the component re-renders frequently:

const reactionItems = React.useMemo(() => {
  const items: Record<string, { count: number; userNames: string[]; reactedByMe: boolean }> = {};
  reactions.forEach((reaction) => {
    // ... (existing logic)
  });
  return items;
}, [reactions, currentUser?.userId]);

This ensures that the reactionItems object is only recalculated when the reactions array or the current user's ID changes.

bigbluebutton-html5/imports/ui/services/features/index.js (2)

121-126: LGTM: Consistent implementation, consider refactoring

The useIsEditChatMessageEnabled function is implemented correctly and consistently with the other feature-checking functions. It properly checks both the disabled features list and the chat toolbar settings.

Consider refactoring these similar functions into a single, more generic function to reduce code duplication. For example:

function useIsChatFeatureEnabled(featureName, toolbarOption) {
  return (
    useDisabledFeatures().indexOf(featureName) === -1
    && window.meetingClientSettings.public.chat.toolbar.includes(toolbarOption)
  );
}

// Usage:
export const useIsReplyChatMessageEnabled = () => useIsChatFeatureEnabled('replyChatMessage', 'reply');
export const useIsDeleteChatMessageEnabled = () => useIsChatFeatureEnabled('deleteChatMessage', 'delete');
export const useIsEditChatMessageEnabled = () => useIsChatFeatureEnabled('editChatMessage', 'edit');

This approach would make the code more maintainable and easier to extend in the future.


107-133: Summary: Well-implemented features with room for improvement

The four new functions (useIsReplyChatMessageEnabled, useIsDeleteChatMessageEnabled, useIsEditChatMessageEnabled, and useIsChatMessageReactionsEnabled) are well-implemented and consistent with the existing code structure. They correctly check both the disabled features list and the chat toolbar settings to determine if each feature is enabled.

However, there are two main points for improvement:

  1. Consider refactoring these similar functions into a single, more generic function to reduce code duplication and improve maintainability.
  2. Clarify the distinction between useIsChatMessageReactionsEnabled and the existing useIsReactionsEnabled function to prevent potential confusion and misuse.

Addressing these points will enhance the overall quality and clarity of the code.

bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts (1)

529-529: LGTM! Consider adding documentation for the toolbar property.

The addition of the toolbar property to the Chat interface is a good enhancement, allowing for a customizable toolbar in the chat interface. This aligns well with the PR objective of introducing message reactions.

Consider adding a brief comment to document the purpose and expected content of the toolbar array. For example:

/**
 * An array of strings representing the available toolbar actions in the chat interface.
 * This may include actions like "react", "reply", etc.
 */
toolbar: string[]
bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts (1)

572-572: LGTM. Consider documenting the toolbar property.

The addition of the toolbar property is a good preparatory step for implementing chat toolbar functionality. However, to improve clarity and maintainability, consider the following suggestions:

  1. Add a comment explaining the purpose and expected usage of the toolbar property.
  2. Consider whether any default toolbar items should be defined at this stage.

Here's a suggested modification with added documentation:

-      toolbar: [],
+      // Defines the items/actions available in the chat toolbar.
+      // Each item should be an object with properties like id, icon, and action.
+      toolbar: [
+        // Example: { id: 'emoji', icon: 'smile', action: 'openEmojiPicker' },
+      ],
bigbluebutton-html5/public/locales/en.json (2)

45-47: Chat toolbar action labels look good, with a minor suggestion.

The new entries for chat toolbar actions (reply, edit, delete) are clear and consistent. However, for better consistency, consider adding a placeholder to the edit and delete labels as well.

Consider updating the edit and delete labels to include a placeholder:

-    "app.chat.toolbar.edit": "Edit",
-    "app.chat.toolbar.delete": "Delete",
+    "app.chat.toolbar.edit": "Edit message {0}",
+    "app.chat.toolbar.delete": "Delete message {0}",

This would allow for more context-specific labels if needed in the future.


Line range hint 1-1000: Suggestion for improving consistency in existing content.

While reviewing the file, I noticed some inconsistencies in capitalization and punctuation. Consider the following improvements:

  1. Standardize capitalization: Choose either sentence case or title case for all labels and stick to it consistently.
  2. Consistent punctuation: Decide whether to use periods at the end of short labels/messages and apply the rule consistently throughout the file.

These changes would improve the overall consistency and maintainability of the localization file. Consider creating a style guide for localization strings to ensure consistency in future additions and modifications.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/styles.ts (1)

Line range hint 78-80: Consider exporting ButtonLoadMore in the default export

Currently, ButtonLoadMore is defined but not included in the default export. If ButtonLoadMore is intended for use outside this module, consider adding it to the default export for consistency.

Apply this diff if appropriate:

 export default {
   MessageList,
   UnreadButton,
+  ButtonLoadMore,
 };
bigbluebutton-html5/imports/ui/hooks/useStickyScroll.ts (1)

Line range hint 52-56: Add Cleanup for Timeouts in useEffect

The timeout set in stopObserving may remain active if the component unmounts before it executes, leading to potential memory leaks.

Add a cleanup function in useEffect to clear any pending timeouts when the component unmounts:

useEffect(
  () => () => {
    observer.disconnect();
+   clearTimeout(timeout.current);
  },
  [],
);
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-edit-form/component.tsx (3)

85-93: Provide user feedback when message is below minimum length

Currently, if the message length is less than MIN_MESSAGE_LENGTH, the handleSubmit function returns without informing the user. This can confuse users when their message is not submitted. Consider displaying an error message to inform the user that the message is too short.

Apply this diff to add an error message:

     if (msg.length < MIN_MESSAGE_LENGTH || chatEditMessageLoading) return;

+    if (msg.length < MIN_MESSAGE_LENGTH) {
+      setError(intl.formatMessage(
+        intlMessages.errorMinMessageLength,
+        { minLength: MIN_MESSAGE_LENGTH },
+      ));
+      return;
+    }

Also, add the following to intlMessages:

     errorMaxMessageLength: {
       id: 'app.chat.errorMaxMessageLength',
     },
+    errorMinMessageLength: {
+      id: 'app.chat.errorMinMessageLength',
+      defaultMessage: 'Message must be at least {minLength} characters long.',
+    },

42-48: Ensure chat configuration values are defined

If any of the values from CHAT_CONFIG are undefined or null, it could lead to unexpected behavior or errors. Consider adding default values or validation checks to ensure that the component functions correctly even if the configuration is incomplete.

For example, you can set default values like this:

 const CHAT_CONFIG = window.meetingClientSettings.public.chat || {};
 const AUTO_CONVERT_EMOJI = CHAT_CONFIG.autoConvertEmoji;
 const MIN_MESSAGE_LENGTH = CHAT_CONFIG.min_message_length || 1;
 const MAX_MESSAGE_LENGTH = CHAT_CONFIG.max_message_length || 500;
 const PUBLIC_CHAT_ID = CHAT_CONFIG.public_id;
 const PUBLIC_GROUP_CHAT_ID = CHAT_CONFIG.public_group_id;

28-158: Consider adding unit tests for the new component

Adding unit tests for the ChatEditMessageForm component will help ensure that it behaves as expected and will facilitate future maintenance and refactoring.

Would you like assistance in writing unit tests for this component?

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/styles.ts (1)

215-218: Consider renaming 'Container' to a more descriptive name

The Container component is quite generic. Renaming it to something more specific, like ChatMessageContainer, would improve code readability and reduce potential confusion in the codebase.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-toolbar/component.tsx (1)

106-113: Handle errors in 'chatDeleteMessage' mutation

Currently, the chatDeleteMessage mutation does not handle potential errors or provide user feedback upon success or failure. Consider adding error handling to enhance user experience.

Modify the mutation call to include error handling:

chatDeleteMessage({
  variables: {
    chatId,
    messageId,
  },
+ }).then(() => {
+   // Optionally show a success message or perform any action after deletion
+ }).catch((error) => {
+   // Handle the error, e.g., display an error notification
+   console.error('Failed to delete message:', error);
});
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5b3fa08 and 34439c9.

📒 Files selected for processing (32)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/EditGroupChatMessageReqMsgHdlr.scala (1 hunks)
  • bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/Types/message.ts (2 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-form/component.tsx (3 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-form/mutations.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/component.tsx (6 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/component.tsx (8 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-content/text-content/component.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-edit-form/component.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-edit-form/styles.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-header/component.tsx (2 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-reactions/component.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-reactions/styles.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-replied/component.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-replied/styles.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-toolbar/component.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-toolbar/styles.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/mutations.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/styles.ts (5 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/component.tsx (4 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/queries.ts (2 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/styles.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-reply-intention/component.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-reply-intention/styles.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/components/chat/chat-graphql/component.tsx (1 hunks)
  • bigbluebutton-html5/imports/ui/core/enums/chat.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts (1 hunks)
  • bigbluebutton-html5/imports/ui/hooks/useStickyScroll.ts (3 hunks)
  • bigbluebutton-html5/imports/ui/services/features/index.js (1 hunks)
  • bigbluebutton-html5/imports/ui/services/storage/hooks.ts (1 hunks)
  • bigbluebutton-html5/private/config/settings.yml (2 hunks)
  • bigbluebutton-html5/public/locales/en.json (2 hunks)
🧰 Additional context used
🪛 Biome
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/component.tsx

[error] 317-317: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-reactions/component.tsx

[error] 77-77: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

🔇 Additional comments (62)
bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-reactions/styles.ts (2)

1-2: LGTM: Imports are appropriate and follow good practices.

The imports are correct and necessary for the styled components defined in this file. Using a separate palette file for colors is a good practice for maintaining consistent styling across the application.


24-27: LGTM: ReactionsWrapper component is simple and effective.

The ReactionsWrapper component is well-designed for its purpose. Using flexbox with wrap enabled is an appropriate choice for handling multiple reaction elements, ensuring they are displayed neatly regardless of the container's width.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-content/text-content/component.tsx (2)

15-15: LGTM! Good default value for testing.

The addition of a default value for dataTest ensures consistent testability. The chosen default 'messageContent' is descriptive and appropriate for this component.


Line range hint 1-33: Overall, good improvements to component testability and flexibility.

The changes in this file enhance the ChatMessageTextContent component's testability and flexibility. The addition of the dataTest prop and its usage in the component are well-implemented. The suggestions provided are minor and aimed at further improving clarity and robustness.

These changes align well with the PR objectives of enhancing the chat functionality. Good job on maintaining backward compatibility while introducing new features.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-edit-form/styles.ts (2)

1-4: LGTM: Imports are appropriate and consistent.

The imports are well-organized and import the necessary styling utilities from the project's stylesheets. The use of absolute imports is consistent with the project structure.


1-34: Overall, excellent implementation of styled components for chat message editing.

This new file introduces well-structured and consistently styled components for the chat message editing interface. The use of TypeScript for prop types and the consistent use of imported style variables contribute to a maintainable and type-safe codebase.

The components align well with the PR objective of introducing message reactions functionality. The minor suggestions provided in the individual component reviews will further enhance the code quality and consistency.

Great job on this implementation!

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-replied/styles.tsx (5)

1-2: LGTM: Imports are correctly structured and necessary.

The import statements are well-organized, importing the required styled function from 'styled-components' and the necessary color constants from the local palette file. This setup provides a good foundation for the styled components defined in this file.


15-17: LGTM: Typography component provides a good base for text elements.

The Typography component is a simple yet effective base for text-related elements. By handling overflow, it ensures that text content behaves consistently across different uses. This approach promotes reusability and consistency in the styling of text elements throughout the chat interface.


34-38: LGTM: DeleteMessage component provides clear styling for deleted message indicators.

The DeleteMessage component is well-defined with appropriate styling to distinguish deleted message indicators. The use of italic and bold font styles, along with the colorText from the imported palette, ensures that these indicators stand out while maintaining consistency with the overall design system.


40-45: LGTM: Default export provides a clean interface for component usage.

The default export is well-structured, providing a clean and organized way to import all the styled components defined in this file. This approach makes it easy for other parts of the application to use these components as needed.


1-45: Overall: Well-structured and maintainable styled components for chat messages.

This file demonstrates good use of styled-components and TypeScript to create a set of reusable, type-safe components for displaying chat messages. The components are logically organized, with a clear hierarchy (Typography as a base, extended by Username and Message). The use of a shared color palette promotes consistency across the application.

Key strengths:

  1. Proper use of TypeScript for prop typing.
  2. Consistent use of imported color constants.
  3. Logical component hierarchy and composition.
  4. Clear and descriptive component names.

While the implementation is solid, consider the minor suggestions provided in previous comments to further enhance usability and robustness:

  1. Adding a hover effect to the Container for better interactivity.
  2. Implementing a fallback color for the Username component.
  3. Adding an ellipsis for truncated text in the Message component.

These styled components provide a strong foundation for building a visually consistent and user-friendly chat interface.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-header/component.tsx (2)

25-25: LGTM! Prop destructuring updated correctly.

The deleteTime prop has been correctly added to the component's props destructuring, maintaining consistency with the ChatMessageHeaderProps interface.


Line range hint 1-52: Overall, the changes look good and implement the delete time feature well.

The addition of the deleteTime property and its integration into the ChatMessageHeader component is well-implemented. The changes consistently handle the new functionality across the component's interface, props, and rendering logic. The code maintains good React practices and typing.

A few minor suggestions were made for documentation and formatting, but these are not critical issues. Great job on implementing this feature!

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/mutations.ts (2)

1-1: LGTM: Correct import for GraphQL mutations.

The import of gql from '@apollo/client' is correct and necessary for defining GraphQL mutations.


1-39: Overall, well-structured file with minor suggestions for improvement.

This new file introduces GraphQL mutations for chat functionality, including editing messages, deleting messages, and managing reactions. The mutations are well-defined and properly exported. To further enhance the code:

  1. Consider adding explicit return types to all mutations for improved type safety.
  2. Maintain consistent ordering of mutations across their definitions, default export, and named exports.

These suggestions will improve type checking and code readability without changing the core functionality.

bigbluebutton-html5/imports/ui/services/storage/hooks.ts (2)

56-56: LGTM: Exporting STORAGES constant

Exporting the STORAGES constant is a good practice. It allows other modules to import and use these storage type definitions, promoting consistency across the codebase.


56-61: Verify usage of newly exported STORAGES constant

The export of the STORAGES constant is a low-risk change that can improve code reusability. However, it's important to ensure that this new export doesn't introduce any conflicts or issues in other parts of the codebase that may already be using similar constants.

Let's verify the usage of STORAGES across the codebase:

✅ Verification successful

Verified: Export of STORAGES does not introduce conflicts

The addition of the STORAGES export is confirmed to be low-risk and does not cause any conflicts within the codebase. No existing imports or declarations conflict with the newly exported constant.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for existing usage or potential conflicts with STORAGES

# Search for imports of STORAGES from this file
echo "Checking for imports of STORAGES:"
rg --type typescript "import.*STORAGES.*from.*['\"]\.\.?/services/storage/hooks['\"]"

# Search for other declarations of STORAGES to check for conflicts
echo "\nChecking for other declarations of STORAGES:"
rg --type typescript "const\s+STORAGES\s*="

# Search for usage of storage types to see if they match our constants
echo "\nChecking for usage of storage types:"
rg --type typescript "(local|session|in-memory)\s+storage"

Length of output: 570


Script:

#!/bin/bash
# Description: Check for existing usage or potential conflicts with STORAGES

# Search for imports of STORAGES from this file
echo "Checking for imports of STORAGES:"
rg "import.*STORAGES.*from.*['\"]\.\.?/services/storage/hooks['\"]" --glob '*.ts*'

# Search for other declarations of STORAGES to check for conflicts
echo "\nChecking for other declarations of STORAGES:"
rg "const\s+STORAGES\s*=" --glob '*.ts*'

# Search for usage of storage types to see if they match our constants
echo "\nChecking for usage of storage types:"
rg "(local|session|in-memory)\s+storage" --glob '*.ts*'

Length of output: 652

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-reply-intention/styles.tsx (3)

1-7: LGTM: Import statements are appropriate and concise.

The import statements are well-organized and import only the necessary components and constants for the styled components in this file.


34-40: LGTM: Typography component provides a solid base for text styling.

The Typography styled component is well-defined with appropriate text styling properties. The use of ellipsis for text overflow is a good practice for handling long text.


63-68: LGTM: Export statement is clear and comprehensive.

The default export includes all the styled components created in this file, allowing for easy import and destructuring in other files.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-replied/component.tsx (4)

1-13: LGTM: Imports and message definitions are well-structured.

The imports are appropriate for the component's functionality, and the use of react-intl for internationalization is a good practice. The deletion message is properly defined using defineMessages.


24-29: LGTM: Component definition and prop handling are well-implemented.

The ChatMessageReplied component is correctly defined as a React functional component. Props are properly destructured, improving code readability. The use of the useIntl hook for internationalization is appropriate.


66-66: LGTM: Correct component export.

The component is properly exported as the default export, following common React practices.


1-66: Overall assessment: Well-implemented component with minor improvement opportunities.

The ChatMessageReplied component is a well-structured and functional implementation for displaying replied messages in a chat interface. It follows React best practices, uses TypeScript for type safety, and incorporates internationalization effectively.

Key strengths:

  1. Clear and appropriate prop definitions
  2. Effective use of styled components
  3. Proper handling of deleted messages
  4. Good use of React hooks and functional component pattern

Suggestions for improvement:

  1. Add JSDoc comments to the interface props for better documentation
  2. Refactor the click handler logic for better separation of concerns
  3. Consider using a useEffect hook for managing side effects related to storage

These improvements would further enhance the component's maintainability and adherence to React best practices. Overall, the implementation is solid and achieves its intended functionality effectively.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-toolbar/styles.ts (4)

1-10: LGTM: Import statements are appropriate and concise.

The import statements are well-organized and import only the necessary components and styles. This promotes code readability and maintainability.


89-91: LGTM: EmojiPicker component is simple and clear.

The EmojiPicker styled component is straightforward, wrapping the EmojiPickerComponent and setting its position to relative. This is a clean and appropriate use of styled-components for minor style adjustments.


93-98: LGTM: Export statement is clear and includes all defined components.

The export statement is concise and includes all the styled components defined in this file. This makes it easy for other parts of the application to import and use these components as needed.


1-98: Overall, well-structured and maintainable styled components for the chat message toolbar.

This new file introduces well-organized styled components for a chat message toolbar. The code demonstrates good use of styled-components, appropriate imports, and clear exports. The components are structured to allow for dynamic styling based on props and include considerations for internationalization (RTL support).

A few minor improvements were suggested:

  1. Adding a comment to explain the sequence-based positioning logic in the Container component.
  2. Reviewing the use of !important flags in the EmojiPickerWrapper styles.
  3. Investigating and resolving the TypeScript error that's currently being suppressed with @ts-ignore in the EmojiButton component.

These suggestions aim to enhance code clarity and robustness but don't impact the overall functionality. Great job on creating a clean and maintainable set of styled components for the chat message toolbar!

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-reply-intention/component.tsx (3)

1-8: LGTM: Imports are appropriate and used.

The imports are well-organized and all are utilized within the component. Good job on keeping the imports clean and relevant.


9-14: LGTM: Component declaration and state management are well-implemented.

The ChatReplyIntention component is correctly declared as a functional component. The use of multiple useState hooks for managing independent pieces of state (username, message, emphasizedMessage, and sequence) is appropriate and follows React best practices. The state variables are properly typed with TypeScript, which enhances code reliability.


76-76: LGTM: Component export is correct.

The ChatReplyIntention component is properly exported as the default export of the module, which follows common React component export practices.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/component.tsx (3)

2-2: LGTM: New import for CircularProgress

The addition of the CircularProgress import from @mui/material is appropriate for implementing the loading indicator in the new ChatLoading component. This aligns well with using Material-UI components for consistent UI design.


Line range hint 79-79: LGTM: Proper usage of ChatLoading component

The ChatLoading component is correctly used within the ChatContainer. It's rendered when !idChatOpen is true, which appears to be the appropriate condition for showing a loading state before a chat is opened. This implementation enhances the user experience by providing visual feedback during the loading process.


Line range hint 1-82: Overall assessment: Well-implemented chat loading feature

The changes in this file successfully introduce a loading state for the chat component, enhancing the user experience. The implementation is consistent with React and Material-UI best practices, and it integrates well with the existing code structure.

Key points:

  1. The new CircularProgress import is appropriately used.
  2. The ChatLoading component is well-structured and reuses existing styled components.
  3. The usage of ChatLoading in ChatContainer is correct and improves the overall user interface.

The only minor suggestion is to consider moving the inline style for CircularProgress to a styled component for better maintainability. Overall, this is a solid implementation that achieves the intended goal of providing visual feedback during chat loading.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-reactions/component.tsx (3)

1-20: LGTM: Imports and message definitions are well-structured.

The imports and message definitions are appropriate for the component's functionality. The use of react-intl for internationalization and the custom useCurrentUser hook demonstrates good practices in React development.


104-104: LGTM: Proper component export.

The default export of the ChatMessageReactions component follows standard React practices.


1-104: Overall assessment: Well-implemented chat message reactions component with minor improvements suggested.

The ChatMessageReactions component is well-structured and effectively implements the chat message reactions feature. It follows React best practices, uses appropriate libraries for internationalization and styling, and handles different scenarios comprehensively.

Key strengths:

  1. Good use of TypeScript for type safety.
  2. Efficient data processing for reactions.
  3. Comprehensive rendering logic with tooltips for enhanced user experience.

Suggested improvements:

  1. Memoize the reactionItems object for potential performance gains.
  2. Add key prop to mapped elements in the render function.
  3. Improve type safety for the em-emoji component.
  4. Consider extracting the Reaction interface for better reusability.

These minor enhancements will further improve the component's performance, type safety, and maintainability.

🧰 Tools
🪛 Biome

[error] 77-77: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/groupchats/EditGroupChatMessageReqMsgHdlr.scala (1)

48-48: ⚠️ Potential issue

Refine the condition for allowing chat message edits

The modification to the condition for allowing chat message edits provides more granular control, which is good. However, there are a few points to consider:

  1. The variable applyPermissionCheck is not defined in the visible code. Ensure it's properly defined and initialized before this check.

  2. This change might allow editing in scenarios where it was previously disallowed. Please verify that this aligns with the intended behavior and update the tests accordingly.

  3. The condition has become more complex. Consider extracting it into a separate method for better readability and maintainability.

To verify the usage and definition of applyPermissionCheck, please run the following script:

This script will help us understand if applyPermissionCheck is properly defined and used consistently across the codebase.

bigbluebutton-html5/imports/ui/services/features/index.js (2)

107-112: LGTM: Consistent implementation of feature check

The useIsReplyChatMessageEnabled function follows the established pattern in this file and correctly combines two conditions to determine if the reply feature is enabled. This implementation is consistent with other feature-checking functions and appears to be correct.


114-119: LGTM: Consistent implementation of delete feature check

The useIsDeleteChatMessageEnabled function is implemented correctly, following the same pattern as other feature-checking functions in this file. It appropriately checks both the disabled features list and the chat toolbar settings to determine if the delete feature is enabled.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/component.tsx (3)

53-54: Improved equality check for chat pages

The additions to the areChatPagesEqual function enhance its accuracy by including checks for message content and reaction count. This ensures that the component will properly update when either the message text changes or when reactions are added/removed, improving the overall responsiveness of the chat interface.


87-87: Optimized rendering with React.Fragment

Replacing the outer <div> with <React.Fragment> is a good optimization. This change reduces the DOM depth without affecting the component's functionality, which can lead to slight performance improvements, especially in larger applications. It's a React best practice that helps keep the DOM structure clean.

Also applies to: 105-105


134-134: Clarification needed on subscription behavior change

The removal of the true argument from the useCreateUseSubscription hook call may change the subscription behavior. Could you please provide more context on the purpose of this change and its potential impacts on the chat message subscription? This information will help ensure that the modification doesn't introduce any unintended side effects in the chat functionality.

To help understand the impact of this change, please run the following script:

bigbluebutton-html5/private/config/settings.yml (1)

771-773: New emoji picker toolbar configuration

The addition of the toolbar option under emojiPicker provides flexibility for customizing the emoji picker interface. However, the current empty array [] means no options are enabled by default.

Recommendations:

  1. Consider setting default values that align with the most common use cases.
  2. Ensure that the implementation respects this configuration and doesn't show any toolbar options when the array is empty.
  3. Add a comment explaining how to enable specific options, e.g.:
    toolbar:
      # Uncomment and modify the following line to enable specific toolbar options
      # - reply
      # - edit
      # - delete
      # - reactions

To ensure the new configuration is properly implemented, please run:

#!/bin/bash
# Search for references to emojiPicker toolbar in the codebase
rg "emojiPicker.*toolbar" --type js --type jsx
bigbluebutton-html5/public/locales/en.json (4)

8-8: New error message for chat update looks good.

The new entry "app.chat.errorOnUpdateMessage" is consistent with other error messages and provides clear feedback for users when a chat message update fails.


43-43: Edit time message for chat looks good.

The new entry "app.chat.editTime" correctly uses a placeholder for the time and provides useful information about when a message was last edited.


44-44: Delete message notification looks good.

The new entry "app.chat.deleteMessage" correctly uses a placeholder for the user who deleted the message, providing clear information about message deletion events.


48-51: Chat reaction labels look good.

The new entries for chat reactions provide clear and concise labels for displaying reaction information. They allow for flexible sentence construction when showing who reacted to a message.

bigbluebutton-html5/imports/ui/Types/message.ts (3)

23-23: Addition of messageSequence property looks good

The inclusion of messageSequence: number; is appropriate for tracking the order of messages. This will help in maintaining the correct sequence, especially when messages are loaded asynchronously.


8-9: Ensure consistent use of timestamp types

Currently, timestamps like createdAt, editedAt, and deletedAt are typed as string. Consider using a consistent date representation across your application, such as using Date objects or ISO 8601 formatted strings, to enhance date handling and validation.

Let's verify where and how these timestamp fields are used in the codebase:

#!/bin/bash
# Description: Find all usages of timestamp fields to ensure consistent types.

# Search for timestamp fields in TypeScript interfaces
rg --type ts ":\s*(string|Date)\s*;"

# Search for assignments to these fields
rg --type ts "createdAt|editedAt|deletedAt"

Also applies to: 25-26, 39-39


42-43: Verify inclusion of userId in User interface

The user object within reactions includes a userId property. Ensure that the User interface includes the userId property or consider extending it if necessary.

Check if the User interface contains userId:

✅ Verification successful

User interface correctly includes the userId property.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify if 'userId' is a property of the User interface.

# Search for the 'User' interface definition and look for 'userId'
rg --type ts "export interface User" -A 15 | rg "userId"

Length of output: 65746

bigbluebutton-html5/imports/ui/hooks/useStickyScroll.ts (1)

10-10: ⚠️ Potential issue

Include Dependencies in useMemo Hook

The observer created by useMemo uses stickyElement inside its callback but stickyElement is not included in the dependency array []. This could lead to stale references if stickyElement changes.

To ensure observer updates when stickyElement changes, include it in the dependency array:

    }),
-   [],
+   [stickyElement],
  );

Likely invalid or redundant comment.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/styles.ts (8)

17-19: Imported color variables are correctly added

The addition of colorOffWhite, colorText, and palettePlaceholderText from the palette ensures that the new styles have access to the necessary color variables.


29-31: New properties added to ChatWrapperProps are appropriate

Adding $highlight, $toolbarMenuIsOpen, and $reactionPopoverIsOpen to ChatWrapperProps allows for conditional styling based on these state variables, aligning with styled-components best practices.


37-39: New properties added to ChatContentProps are appropriate

Including $highlight, $toolbarMenuIsOpen, and $reactionPopoverIsOpen in ChatContentProps is appropriate for handling conditional styling within the component.


86-97: Conditional styling in ChatWrapper is properly implemented

The conditional styles for $highlight, $toolbarMenuIsOpen, and $reactionPopoverIsOpen in ChatWrapper are correctly implemented to handle hover effects and background changes when certain conditions are met.


109-122: Conditional styling in ChatContent is correctly implemented

The conditional styles in ChatContent for $highlight, $toolbarMenuIsOpen, and $reactionPopoverIsOpen appropriately manage the component's appearance based on its state.


208-210: Added styles for react-loading-skeleton in ChatAvatar

The styles for .react-loading-skeleton ensure consistent sizing within the ChatAvatar component during loading states.


225-229: 'DeleteMessage' styled component is properly implemented

The DeleteMessage component correctly styles deleted messages with italic and bold text, using the appropriate color from colorText.


231-240: 'ChatEditTime' styled component is correctly added

The ChatEditTime component effectively handles the styling for displaying edit times, with appropriate text overflow handling and color settings derived from palettePlaceholderText.

bigbluebutton-html5/imports/ui/components/chat/chat-graphql/chat-message-list/page/chat-message/message-toolbar/component.tsx (2)

137-137: Confirm 'color' prop values for Button components

Ensure that the value 'light' passed to the color prop of Button components is valid according to the Button component's API.

Check the Button component's accepted color values:

#!/bin/bash
# Description: Verify accepted values for the 'color' prop in Button components.

# Test: Find the Button component's definition. Expect: Definition including 'color' prop types.
rg --type typescript 'interface ButtonProps.*color' imports/ui/components/common/button

# Test: Check the color enum or type definitions for acceptable values.
rg --type typescript 'type.*Color.*=' imports/ui/components/common/button

Also applies to: 170-170


69-74: Verify feature flags are correctly implemented

Ensure that the feature flag hooks useIsReplyChatMessageEnabled, useIsChatMessageReactionsEnabled, useIsEditChatMessageEnabled, and useIsDeleteChatMessageEnabled are correctly returning boolean values and that the corresponding features are toggled appropriately in the application settings.

Run the following script to confirm the feature flags' implementation:

Comment on lines +56 to +61
// @ts-ignore
const CloseBtn = styled(Button)`
position: absolute;
top: 2px;
right: 2px;
`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Address the TypeScript issue in the CloseBtn component.

The CloseBtn styled component is well-positioned for its purpose. However, the presence of a @ts-ignore comment indicates a potential type issue that should be addressed.

Instead of using @ts-ignore, consider properly typing the Button component or using a type assertion if necessary. For example:

const CloseBtn = styled(Button as React.ComponentType<any>)`
  position: absolute;
  top: 2px;
  right: 2px;
`;

This approach maintains type safety while still allowing you to style the Button component.

Comment on lines +73 to +87
// @ts-ignore
const EmojiButton = styled(Button)`
margin:0 0 0 ${smPaddingX};
align-self: center;
font-size: 0.5rem;

[dir="rtl"] & {
margin: 0 ${smPaddingX} 0 0;
-webkit-transform: scale(-1, 1);
-moz-transform: scale(-1, 1);
-ms-transform: scale(-1, 1);
-o-transform: scale(-1, 1);
transform: scale(-1, 1);
}
`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Investigate and resolve the TypeScript error instead of using @ts-ignore.

The EmojiButton component extends the Button component with additional styling and includes good RTL support. However, the use of @ts-ignore (line 73) suggests there's an underlying TypeScript error that's being suppressed.

Instead of using @ts-ignore, it's recommended to investigate and resolve the underlying TypeScript error. This could involve:

  1. Checking if the Button component is properly typed.
  2. Ensuring that all props passed to the styled(Button) are compatible with the Button component's prop types.
  3. If necessary, creating a proper type definition for the styled Button component.

Resolving this issue will improve type safety and make the code more robust.

Comment on lines +60 to +101
return (
<Styled.ReactionsWrapper>
{Object.keys(reactionItems).map((emoji) => {
const details = reactionItems[emoji];
let label = intl.formatMessage(intlMessages.reactedBy);
if (details.userNames.length) {
const users = details.userNames.join(', ');
label += ` ${users}`;

if (details.reactedByMe) {
label += ` ${intl.formatMessage(intlMessages.and)} ${intl.formatMessage(intlMessages.you)}`;
}
} else if (details.reactedByMe) {
label += ` ${intl.formatMessage(intlMessages.you)}`;
}

return (
<TooltipContainer title={label}>
<Styled.EmojiWrapper
highlighted={details.reactedByMe}
onClick={() => {
if (details.reactedByMe) {
deleteReaction(emoji);
} else {
sendReaction(emoji);
}
}}
>
{/* @ts-ignore */}
<em-emoji
size={parseFloat(
window.getComputedStyle(document.documentElement).fontSize,
)}
native={emoji}
/>
<span>{details.count}</span>
</Styled.EmojiWrapper>
</TooltipContainer>
);
})}
</Styled.ReactionsWrapper>
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

⚠️ Potential issue

Add key prop to mapped elements and improve type safety.

The rendering logic is well-implemented, but there are a couple of areas for improvement:

  1. Add a key prop to the mapped elements to help React efficiently update the list:
{Object.keys(reactionItems).map((emoji) => (
  <TooltipContainer key={emoji} title={label}>
    {/* ... */}
  </TooltipContainer>
))}
  1. Instead of using @ts-ignore, consider creating a custom type definition for the em-emoji component:
declare global {
  namespace JSX {
    interface IntrinsicElements {
      'em-emoji': React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
        size?: number;
        native: string;
      };
    }
  }
}

Place this type definition in a separate .d.ts file or at the top of your current file.

These changes will improve type safety and React's rendering efficiency.

🧰 Tools
🪛 Biome

[error] 77-77: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

Comment on lines +128 to +133
export function useIsChatMessageReactionsEnabled() {
return (
useDisabledFeatures().indexOf('chatMessageReactions') === -1
&& window.meetingClientSettings.public.chat.toolbar.includes('reactions')
);
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

LGTM: Implementation Correct, Clarification Needed

The implementations of both useIsReactionsEnabled and useIsChatMessageReactionsEnabled are correct and consistent with the feature-checking functions. However, to prevent confusion between these two similarly named functions, consider adding comments or renaming them to clarify their distinct purposes.

🔗 Analysis chain

LGTM: Consistent implementation, clarification needed

The useIsChatMessageReactionsEnabled function is implemented correctly and consistently with the other feature-checking functions. It properly checks both the disabled features list and the chat toolbar settings.

However, there's a potential for confusion between this function and the existing useIsReactionsEnabled function (line 70-74). It's important to clarify the difference between these two functions to prevent misuse.

To verify the distinction, please run the following script:

This script will display both implementations side by side, allowing us to compare and document the differences. Please add comments to clarify the specific use case for each function and how they differ.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Compare the implementations of useIsReactionsEnabled and useIsChatMessageReactionsEnabled

echo "useIsReactionsEnabled implementation:"
sed -n '/export function useIsReactionsEnabled/,/}/p' bigbluebutton-html5/imports/ui/services/features/index.js

echo "\nuseIsChatMessageReactionsEnabled implementation:"
sed -n '/export function useIsChatMessageReactionsEnabled/,/}/p' bigbluebutton-html5/imports/ui/services/features/index.js

Length of output: 870

# the default logoutUrl matches window.location.origin i.e. bigbluebutton.org for demo.bigbluebutton.org
# in some cases we want only custom logoutUrl to be used when provided on meeting create. Default value: true
askForConfirmationOnLeave: true
askForConfirmationOnLeave: false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Removing the exit confirmation affects multiple components

The change to askForConfirmationOnLeave: false removes the confirmation prompt, impacting the following areas:

  • Configuration: bigbluebutton-html5/private/config/settings.yml
  • User Settings Types: bigbluebutton-html5/imports/ui/Types/meetingClientSettings.ts
  • Initial Values: bigbluebutton-html5/imports/ui/core/initial-values/meetingClientSettings.ts
  • Audio Component: bigbluebutton-html5/imports/ui/components/audio/container.jsx
  • Documentation: docs/docs/development/api.md

Potential Implications:

  1. User Experience:

    • Users may accidentally leave sessions without warning, leading to unintended disruptions.
  2. Consistency:

    • Multiple components rely on this setting, so the change ensures consistent behavior across the application.
  3. Configurability:

    • Consider making this setting configurable per meeting or user preference to balance user experience and flexibility.

Recommendations:

  • Review UX Goals:

    • Ensure that removing the confirmation aligns with the overall user experience strategy.
  • Implement Safeguards:

    • Consider adding notifications or alternative safeguards to prevent accidental exits.
  • Provide Configurability:

    • Allow users or administrators to toggle this setting based on meeting requirements.
🔗 Analysis chain

Consider the implications of removing the exit confirmation

The change from askForConfirmationOnLeave: true to false removes the confirmation prompt when users attempt to leave the session. While this can improve user experience by reducing friction, it may lead to accidental exits.

Consider the following:

  1. Is this change intentional and aligned with the project's UX goals?
  2. Are there any specific use cases (e.g., educational settings) where accidental exits could be problematic?
  3. Could this be made configurable per meeting or user preference?

To ensure this change doesn't conflict with other parts of the codebase, please run:



🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for references to askForConfirmationOnLeave in the codebase
rg "askForConfirmationOnLeave" --type js --type jsx

Length of output: 163


Script:

#!/bin/bash
# Search for references to askForConfirmationOnLeave in YAML files
fd --type f --extension yml,yaml | xargs rg "askForConfirmationOnLeave"

Length of output: 619


Script:

#!/bin/bash
# Extract lines surrounding references to askForConfirmationOnLeave in TypeScript and JSX files for context
fd --type f --extension ts,jsx | xargs rg -C 3 "askForConfirmationOnLeave"

Length of output: 3401

Comment on lines +143 to +152
const deleteReaction = useCallback((reactionEmoji: string) => {
chatDeleteReaction({
variables: {
chatId: message.chatId,
messageId: message.messageId,
reactionEmoji,
},
});
}, []);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Include dependencies in 'deleteReaction' useCallback hook

The deleteReaction function relies on chatDeleteReaction and message. Include these in the dependency array to prevent issues with stale closures and ensure the callback functions correctly.

Apply this diff to address the issue:

       }, []);
+      }, [chatDeleteReaction, message]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const deleteReaction = useCallback((reactionEmoji: string) => {
chatDeleteReaction({
variables: {
chatId: message.chatId,
messageId: message.messageId,
reactionEmoji,
},
});
}, []);
const deleteReaction = useCallback((reactionEmoji: string) => {
chatDeleteReaction({
variables: {
chatId: message.chatId,
messageId: message.messageId,
reactionEmoji,
},
});
}, [chatDeleteReaction, message]);

Comment on lines +133 to +141
const sendReaction = useCallback((reactionEmoji: string) => {
chatSendReaction({
variables: {
chatId: message.chatId,
messageId: message.messageId,
reactionEmoji,
},
});
}, []);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Include dependencies in 'sendReaction' useCallback hook

The sendReaction function depends on chatSendReaction and message. To ensure the callback updates when these variables change, include them in the dependency array of useCallback.

Apply this diff to include the necessary dependencies:

       }, []);
+      }, [chatSendReaction, message]);

Committable suggestion was skipped due to low confidence.

Comment on lines +153 to +175
const CHAT_TOOLBAR_CONFIG = window.meetingClientSettings.public.chat.toolbar;
const isModerator = currentUser?.isModerator;
const isPublicChat = chat?.public;
const isLocked = currentUser?.locked || currentUser?.userLockSettings?.disablePublicChat;
const disablePublicChat = meeting?.lockSettings?.disablePublicChat
|| currentUser?.userLockSettings?.disablePublicChat;
const disablePrivateChat = meeting?.lockSettings?.disablePrivateChat;

let locked = false;

if (!isModerator) {
if (isPublicChat) {
locked = (isLocked && disablePublicChat) || false;
} else {
locked = (isLocked && disablePrivateChat) || false;
}
}

const hasToolbar = CHAT_TOOLBAR_CONFIG.length > 0
&& message.deletedAt === null
&& !editing
&& !!message.user
&& !locked;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ensure 'CHAT_TOOLBAR_CONFIG' is defined before accessing 'length'

Accessing CHAT_TOOLBAR_CONFIG.length without verifying that CHAT_TOOLBAR_CONFIG is defined may lead to runtime errors if it's undefined. Add a check to ensure CHAT_TOOLBAR_CONFIG is not undefined before accessing its properties.

Apply this diff to prevent potential errors:

-      const hasToolbar = CHAT_TOOLBAR_CONFIG.length > 0
+      const hasToolbar = CHAT_TOOLBAR_CONFIG && CHAT_TOOLBAR_CONFIG.length > 0
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const CHAT_TOOLBAR_CONFIG = window.meetingClientSettings.public.chat.toolbar;
const isModerator = currentUser?.isModerator;
const isPublicChat = chat?.public;
const isLocked = currentUser?.locked || currentUser?.userLockSettings?.disablePublicChat;
const disablePublicChat = meeting?.lockSettings?.disablePublicChat
|| currentUser?.userLockSettings?.disablePublicChat;
const disablePrivateChat = meeting?.lockSettings?.disablePrivateChat;
let locked = false;
if (!isModerator) {
if (isPublicChat) {
locked = (isLocked && disablePublicChat) || false;
} else {
locked = (isLocked && disablePrivateChat) || false;
}
}
const hasToolbar = CHAT_TOOLBAR_CONFIG.length > 0
&& message.deletedAt === null
&& !editing
&& !!message.user
&& !locked;
const CHAT_TOOLBAR_CONFIG = window.meetingClientSettings.public.chat.toolbar;
const isModerator = currentUser?.isModerator;
const isPublicChat = chat?.public;
const isLocked = currentUser?.locked || currentUser?.userLockSettings?.disablePublicChat;
const disablePublicChat = meeting?.lockSettings?.disablePublicChat
|| currentUser?.userLockSettings?.disablePublicChat;
const disablePrivateChat = meeting?.lockSettings?.disablePrivateChat;
let locked = false;
if (!isModerator) {
if (isPublicChat) {
locked = (isLocked && disablePublicChat) || false;
} else {
locked = (isLocked && disablePrivateChat) || false;
}
}
const hasToolbar = CHAT_TOOLBAR_CONFIG && CHAT_TOOLBAR_CONFIG.length > 0
&& message.deletedAt === null
&& !editing
&& !!message.user
&& !locked;

Comment on lines +287 to +292
const handler = (e: Event) => {
if (e instanceof CustomEvent) {
setRepliedMessageId(e.detail.messageId);
textAreaRef.current?.textarea.focus();
}
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance type safety by specifying the event type in the handler

Currently, the event handler handler uses a generic Event type and checks if it is an instance of CustomEvent. To improve type safety and eliminate unnecessary runtime type checks, you can type the event parameter directly as CustomEvent<{ messageId: string }>.

Apply this diff to implement the suggestion:

-        const handler = (e: Event) => {
-          if (e instanceof CustomEvent) {
-            setRepliedMessageId(e.detail.messageId);
-            textAreaRef.current?.textarea.focus();
-          }
-        };
+        const handler = (e: CustomEvent<{ messageId: string }>) => {
+          setRepliedMessageId(e.detail.messageId);
+          textAreaRef.current?.textarea.focus();
+        };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const handler = (e: Event) => {
if (e instanceof CustomEvent) {
setRepliedMessageId(e.detail.messageId);
textAreaRef.current?.textarea.focus();
}
};
const handler = (e: CustomEvent<{ messageId: string }>) => {
setRepliedMessageId(e.detail.messageId);
textAreaRef.current?.textarea.focus();
};

Comment on lines +326 to +335
window.dispatchEvent(
new CustomEvent(ChatEvents.CHAT_REPLY_INTENTION, {
detail: {
username: undefined,
message: undefined,
messageId: undefined,
chatId: undefined,
},
}),
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Reset repliedMessageId state after sending a reply message

After sending a reply message, the repliedMessageId state is not reset, which could cause subsequent messages to incorrectly reference the previous reply. To ensure the reply state is cleared, call setRepliedMessageId(undefined) after the message is sent.

Apply this diff to resolve the issue:

            chatSendMessage({
              variables: {
                chatMessageInMarkdownFormat: msg,
                chatId: chatId === PUBLIC_CHAT_ID ? PUBLIC_GROUP_CHAT_ID : chatId,
                replyToMessageId: repliedMessageId,
              },
            });

+           setRepliedMessageId(undefined);

            window.dispatchEvent(
              new CustomEvent(ChatEvents.CHAT_REPLY_INTENTION, {
                detail: {
                  username: undefined,
                  message: undefined,
                  messageId: undefined,
                  chatId: undefined,
                },
              }),
            );

Committable suggestion was skipped due to low confidence.

@github-actions

github-actions Bot commented Oct 9, 2024

Copy link
Copy Markdown

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@github-actions

Copy link
Copy Markdown

This pull request has conflicts ☹
Please resolve those so we can review the pull request.
Thanks.

@JoVictorNunes
JoVictorNunes marked this pull request as ready for review October 15, 2024 11:21
@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
bigbluebutton-html5/public/locales/en.json (1)

48-51: LGTM! Consider adding a period for consistency.

The new localization strings for chat reactions are well-structured and clear. They follow the existing naming conventions and are placed in an appropriate section of the file.

For consistency with other similar strings in the file, consider adding a period at the end of the "app.chat.toolbar.reactions.findReactionButtonLabel" value:

-    "app.chat.toolbar.reactions.findReactionButtonLabel": "Find a reaction",
+    "app.chat.toolbar.reactions.findReactionButtonLabel": "Find a reaction.",

This change would make it consistent with other button labels in the file that end with a period.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 34439c9 and c416af8.

📒 Files selected for processing (2)
  • bigbluebutton-html5/private/config/settings.yml (2 hunks)
  • bigbluebutton-html5/public/locales/en.json (1 hunks)
🧰 Additional context used
🔇 Additional comments (1)
bigbluebutton-html5/private/config/settings.yml (1)

62-62: Approved: Enabling exit confirmation improves user experience

The change from askForConfirmationOnLeave: false to true is a positive improvement. This will prompt users for confirmation before leaving a session, preventing accidental exits and potential disruptions.

This setting affects multiple components across the application:

  1. Configuration (this file)
  2. User Settings Types
  3. Initial Values
  4. Audio Component
  5. Documentation

By enabling this feature, you're adding an extra layer of protection for users, which aligns well with the PR's objective of enhancing user interaction within the chat system.

@github-actions

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants