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

BA-2211: delete chat messages #208

Merged
merged 4 commits into from
Feb 18, 2025
Merged

Conversation

pt-tsl
Copy link
Contributor

@pt-tsl pt-tsl commented Feb 5, 2025

Acceptance Criteria

  • Given I hover my mouse over a message, when the overlay 3 dots menu appears and I click on it, then I should see a "Delete" option in the menu. (Should already be implemented)
  • Given I click the "Delete" option then, a dialog/delete message should confirm if I am sure that I want to delete the message.
    • The confirmation message changes if it's an individual chat or a group chat
  • Given I click the "Delete" option to confirm, the text should be replaced with "You deleted this message" in gray font.
    • For others in the chat (individual or in a group) the text should be replaced with "This message was deleted." in gray front.
  • A toast message should appear notifying that the message was deleted.
    • Use the existing info icon, not the delete icon for now, nor the Undo button.
    • Make the component as similar as the design as possible.
    • Use the new timed snack-bar component

Guardrail
The snackbar will not have the action button for now

Design Link: https://www.figma.com/design/XRD6wSl1m8Kz6XUcAy5CLp/BaseApp---WEB?node-id=7763-127162&t=MOMbprMUFediIBZh-0

Note: The snackbar has been implemented in another PR
#207

Summary by CodeRabbit

  • New Features

    • Introduced chat room message deletion, allowing users to remove messages.
    • Messages now display a deleted status for improved clarity.
    • Enhanced the delete action with a simplified button label and added control to disable deletion when needed.
    • Improved error notifications during the deletion process.
    • Added support for distinguishing between group and individual messages in the message component.
  • Updates

    • Updated version to 1.0.9, reflecting the addition of message deletion functionality.

Copy link

changeset-bot bot commented Feb 5, 2025

⚠️ No Changeset found

Latest commit: 34b9312

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

coderabbitai bot commented Feb 5, 2025

Walkthrough

This pull request introduces a new GraphQL mutation for deleting chat room messages. It adds input and output types for the deletion operation and updates the Message type to include a deletion flag. The PR also updates the changelog and package version, and modifies the UI components handling delete actions by introducing new props for controlling the visibility and state of delete buttons. Additional exports are provided to expose the new mutations, and the message subscription naming has been updated.

Changes

File(s) Change Summary
packages/components/schema.graphql Added ChatRoomDeleteMessageInput and ChatRoomDeleteMessagePayload types; added chatRoomDeleteMessage mutation; added deleted: Boolean! field in Message type.
packages/components/CHANGELOG.md Updated changelog for version 1.0.9 noting enabled chat room message deletion.
packages/components/package.json Updated package version from 1.0.8 to 1.0.9.
packages/components/modules/__shared__/web/ActionsOverlay/index.tsx
packages/components/modules/__shared__/web/ActionsOverlay/types.ts
packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/index.tsx
packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/types.ts
packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/index.tsx
packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/types.ts
packages/components/modules/comments/web/CommentItem/index.tsx
packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx
Replaced enableDelete with showDeleteButton; added disableDeleteButton prop for better control over delete button visibility and state.
packages/components/modules/messages/common/graphql/fragments/MessageItem.ts Added new deleted field in the GraphQL fragment.
packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts Created new GraphQL mutation file for message deletion and exposed useMessageDeleteMutation hook with error handling.
packages/components/modules/messages/common/graphql/subscriptions/useMessagesListSubscription.tsx Renamed subscription field from chatRoomOnNewMessage to chatRoomOnMessage.
packages/components/modules/messages/common/index.ts Added exports for new message deletion and update mutations.
packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx
packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts
packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/index.tsx
Introduced new isGroup prop to differentiate between group and individual messages, affecting the rendering and handling of delete actions.

Possibly related PRs

  • BA 1936: create chat groups #150: The changes in the main PR, which involve the addition of message deletion functionality and modifications to the GraphQL schema, are related to the retrieved PR that introduces a new field isGroup in the ChatRoom type and updates the mutation for creating chat rooms, as both involve modifications to the GraphQL schema and types related to chat functionality.
  • BA-2111-FE-edit-existing-message #188: The changes in the main PR, particularly the introduction of the deleted field in the Message type and the chatRoomDeleteMessage mutation, are directly related to the modifications in the retrieved PR, which also involves the ActionsOverlay component that handles delete actions. Both PRs focus on enhancing message deletion functionality within the chat context.

Suggested reviewers

  • Ronan-Fernandes
  • anicioalexandre
  • deboracosilveira

Poem

Hop, hop, a change so bright,
Deleting messages with all our might!
A tweak here, a prop there,
Our chat now handles error with care.
CodeRabbit hops away with a smile 😊

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

packages/components/modules/__shared__/web/ActionsOverlay/index.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Cannot read config file: /packages/components/.eslintrc.js
Error: Cannot find module '@baseapp-frontend/config/.eslintrc-with-restricted-paths.js'
Require stack:

  • /packages/components/.eslintrc.js
  • /node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/index.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Module._load (node:internal/modules/cjs/loader:1074:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:135:16)
    at Object. (/packages/components/.eslintrc.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)
packages/components/modules/messages/web/MessagesList/MessagesGroup/SystemMessage/styled.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

Error: Cannot read config file: /packages/components/.eslintrc.js
Error: Cannot find module '@baseapp-frontend/config/.eslintrc-with-restricted-paths.js'
Require stack:

  • /packages/components/.eslintrc.js
  • /node_modules/.pnpm/@eslint+eslintrc@2.1.4/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli-engine/cli-engine.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/eslint.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/eslint/index.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/lib/cli.js
  • /node_modules/.pnpm/eslint@8.57.1/node_modules/eslint/bin/eslint.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1248:15)
    at Module._load (node:internal/modules/cjs/loader:1074:27)
    at TracingChannel.traceSync (node:diagnostics_channel:315:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:217:24)
    at Module.require (node:internal/modules/cjs/loader:1339:12)
    at require (node:internal/modules/helpers:135:16)
    at Object. (/packages/components/.eslintrc.js:1:18)
    at Module._compile (node:internal/modules/cjs/loader:1546:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1691:10)
    at Module.load (node:internal/modules/cjs/loader:1317:32)

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 473e062 and 34b9312.

📒 Files selected for processing (3)
  • packages/components/modules/__shared__/web/ActionsOverlay/index.tsx (6 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/SystemMessage/styled.tsx (1 hunks)
  • packages/components/package.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/SystemMessage/styled.tsx
  • packages/components/package.json
🔇 Additional comments (3)
packages/components/modules/__shared__/web/ActionsOverlay/index.tsx (3)

25-28: LGTM! Props changes enhance delete functionality control.

The new props provide granular control over delete button visibility and state, aligning well with the PR's objectives for message deletion functionality.

Also applies to: 33-33


164-188: LGTM! Mobile delete button implementation is solid.

The implementation correctly handles:

  • Delete button visibility through showDeleteButton
  • Disabled state styling through disableDeleteButton
  • Error color theme for delete action

194-230:

❓ Verification inconclusive

Verify three-dot menu overlay matches design.

The PR requirements specify a three-dot menu overlay should appear on hover. Please verify that the current implementation of ThreeDotsMenuHoverOverlay matches the Figma design reference.


🌐 Web query:

What is the standard appearance and behavior of a three-dot menu (kebab menu) in Material-UI?

💡 Result:

The three-dot menu (kebab menu) in Material-UI follows Material Design guidelines with these standard characteristics:

Appearance

  • Icon: Uses MoreVertIcon (three vertical dots) from Material Icons[1][5][6]
  • Trigger: Typically wrapped in an IconButton component[1][4]
  • Visual Hierarchy: Appears as secondary UI element with muted color scheme by default[4][7]

Behavior

  1. Activation:

    • Opens via click/tap on icon button[1][4]
    • Uses anchorEl state to position menu relative to trigger[1][7]
    const [anchorEl, setAnchorEl] = useState(null);
    const open = Boolean(anchorEl);
  2. Menu Display:

    • Appears as temporary surface above other content[7][10]
    • Auto-repositions near screen edges using Popover component[5][7]
    • Supports keyboard navigation (arrow keys + Enter)[5][7]
  3. Content Structure:

    • Contains MenuItem components in vertical list[4][7]
    • Typical options: "Edit", "Delete", "Settings"[1][4]
    <Menu anchorEl={anchorEl} open={open}>
      <MenuItem onClick={handleClose}>Edit</MenuItem>
      <MenuItem onClick={handleClose}>Delete</MenuItem>
    </Menu>
  4. Interaction:

    • Closes automatically when clicking outside or selecting item[1][7]
    • Supports touch gestures on mobile[2][10]
    • Maintains focus states for accessibility[5][7]

Customization Options

  • Positioning: Adjust with anchorOrigin/transformOrigin props[5][7]
  • Density: Use dense prop for compact layouts[7]
  • Styling: Override styles via sx prop or theme overrides[4][7]

Material-UI's implementation follows WAI-ARIA patterns for accessibility[5][7], with proper role assignments and keyboard navigation built-in. The component uses Material Design 3 specs when configured with ThemeData.useMaterial3[3][10].

Citations:


Action: Verify Three-Dot Menu Overlay Against Design Guidelines

The hover overlay implementation correctly forwards props and honors device hover capability. However, please double-check that the ThreeDotsMenuHoverOverlay conforms to the design requirements as specified by the Figma reference and Material-UI kebab menu standards. In particular:

  • Icon & Trigger: Ensure the overlay uses the appropriate icon (typically MoreVertIcon) and that any trigger (e.g., an IconButton if applicable) behaves as expected.
  • Menu Behavior: Confirm the popover positioning, auto-dismissal, and keyboard navigation align with Material Design guidelines.
  • Visual Consistency: Verify that the overlay’s appearance (spacing, colors, and hierarchy) matches the design spec.

Once these points are verified against the Figma design and Material-UI best practices, please update or confirm the implementation as needed.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Nitpick comments (1)
packages/components/modules/messages/graphql/mutations/MessageDelete.ts (1)

25-51: Consider adding error type validation.

While the error handling is good, consider adding type validation for error messages to ensure consistent error display.

 const commit = (config: UseMutationConfig<MessageDeleteMutation>) =>
   commitMutation({
     ...config,
     onCompleted: (response, errors) => {
       errors?.forEach((error) => {
+        const errorMessage = typeof error.message === 'string' 
+          ? error.message 
+          : 'An unknown error occurred'
-        sendToast(error.message, { type: 'error' })
+        sendToast(errorMessage, { type: 'error' })
       })

       config?.onCompleted?.(response, errors)
     },
     onError: (error) => {
+      const errorMessage = typeof error.message === 'string'
+        ? error.message
+        : 'An unknown error occurred'
-      sendToast(error.message, { type: 'error' })
+      sendToast(errorMessage, { type: 'error' })
       config?.onError?.(error)
     },
   })
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8de60b1 and dc76a75.

⛔ Files ignored due to path filters (11)
  • packages/components/__generated__/ActivityLogsFragment.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ActivityLogsPaginationQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ActivityLogsQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ChatRoomMessagesListPaginationQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ChatRoomQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/MessageDeleteMutation.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/MessageItemFragment.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/MessageUpdateMutation.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/SendMessageMutation.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/useMessagesListSubscription.graphql.ts is excluded by !**/__generated__/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • packages/authentication/package.json (1 hunks)
  • packages/components/modules/__shared__/ActionsOverlay/index.tsx (4 hunks)
  • packages/components/modules/__shared__/ActionsOverlay/types.ts (2 hunks)
  • packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (4 hunks)
  • packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts (1 hunks)
  • packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/index.tsx (1 hunks)
  • packages/components/modules/messages/graphql/fragments/MessageItem.ts (1 hunks)
  • packages/components/modules/messages/graphql/mutations/MessageDelete.ts (1 hunks)
  • packages/components/package.json (1 hunks)
  • packages/components/schema.graphql (3 hunks)
  • packages/config/package.json (1 hunks)
  • packages/design-system/package.json (1 hunks)
  • packages/eslint-plugin/package.json (1 hunks)
  • packages/graphql/package.json (1 hunks)
  • packages/provider/package.json (1 hunks)
  • packages/test/package.json (1 hunks)
  • packages/utils/package.json (1 hunks)
  • packages/wagtail/package.json (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (40)
packages/test/package.json (3)

17-22: Explicit Dependency Version Updates in "dependencies" Section

The dependency versions for @emotion/cache, @emotion/react, @mui/material, @tanstack/react-query, and js-cookie have been updated to explicit version numbers. This change improves build reproducibility and dependency management. Please verify that these versions align with those used in other packages to avoid any version conflicts.


25-25: Explicit Peer Dependency Version for React

The peer dependency for react is now pinned to "18.3.1". Confirm that this specific version meets compatibility requirements across your application and consider if a semver range might be more appropriate for flexibility.


30-43: Pinned Dev Dependency Versions

The development dependencies now use specific version numbers for packages such as @testing-library/jest-dom, @testing-library/react, @testing-library/user-event, and others. This consistency should help avoid ambiguity during development and testing. It is advisable to test that these updates integrate well with your configuration (like TypeScript, Jest, and Babel) without introducing any unexpected issues.

packages/design-system/package.json (5)

17-27: Explicit Dependency Version Updates for Core Packages

The versions for core design system dependencies (e.g., @emotion/cache, @emotion/react, @emotion/styled, @mui/icons-material, @mui/lab, @mui/material, @mui/material-nextjs, @mui/system, @mui/x-date-pickers, and @storybook/react) have been updated from catalog references to explicit version numbers. This change improves reproducibility and clarity in version management. Please verify that these versions are compatible with the rest of the ecosystem in your project.


29-33: Explicit Dependency Version Updates for Additional Libraries

The dependencies for jotai, lodash, next, and react-hook-form are now specified with explicit versions. Note that the version for next is a canary release (14.3.0-canary.24); please confirm that using a canary version is intentional and that any associated risks have been considered.


39-40: Peer Dependency Version Updates

The peer dependencies for react and react-dom have been updated to "18.3.1". Ensure that these versions align with your overall project requirements and are compatible with other parts of your application.


43-45: Updated Babel Presets in DevDependencies

The Babel presets (@babel/preset-env, @babel/preset-react, and @babel/preset-typescript) now use explicit version numbers. This should help maintain consistent builds and eliminate reliance on catalog references.


49-71: Explicit Version Updates for Storybook, Tailwind, and Related Tools

The devDependencies related to Storybook (including various addons and compiler configurations), Tailwind, and TypeScript have been updated with fixed version numbers. These changes are expected to improve build reproducibility and stability in the development workflow. Please verify that these updates integrate seamlessly with your current tooling and processes.

packages/components/modules/messages/graphql/fragments/MessageItem.ts (1)

8-8: LGTM! Addition of deleted field supports message deletion functionality.

The new field is correctly placed and will enable tracking of message deletion states.

packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts (1)

8-8: LGTM! Addition of isGroup prop enables different deletion flows for individual and group chats.

The optional boolean prop aligns with the PR requirements for showing different deletion confirmation messages based on chat type.

packages/components/modules/__shared__/ActionsOverlay/types.ts (2)

3-3: LGTM! Import of ConfirmDialogProps from design system.

The import supports the new DeleteDialogProps type.


31-31: LGTM! Addition of DeleteDialogProps enables customizable confirmation dialogs.

The optional Partial type allows flexible configuration of the deletion confirmation dialog.

packages/components/modules/messages/graphql/mutations/MessageDelete.ts (1)

7-23: LGTM! Well-structured GraphQL mutation for message deletion.

The mutation is correctly defined with proper input type, response fields, and error handling.

packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/index.tsx (1)

98-103: LGTM! Proper prop passing implementation.

The isGroup prop is correctly passed to the MessageItem component, enabling different delete confirmation messages for group and individual chats.

packages/components/modules/__shared__/ActionsOverlay/index.tsx (1)

101-117: LGTM! Enhanced dialog customization.

The addition of DeleteDialogProps improves component reusability by allowing customization of the confirmation dialog. The simplified delete button label maintains consistency across the application.

packages/eslint-plugin/package.json (1)

19-27: Verify dependency version compatibility.

Please verify the following:

  1. Consider updating eslint to the latest version for security patches
  2. The specified TypeScript version 5.4.5 seems to be from the future
packages/provider/package.json (3)

16-18: Dependency Version Updates for Providers
The explicit version updates for @tanstack/react-query and lodash ensure that the package now uses reproducible versions rather than catalog references. This change improves predictability during builds.


21-22: Peer Dependency Update
Updating the react peer dependency to "18.3.1" aligns this package with the versions being used in other parts of the repository. Make sure that all consuming packages are compatible with this version.


24-28: Dev Dependency Version Standardization
The updates for @types/lodash, @types/react, and typescript now use specific version numbers. This explicit versioning will help avoid accidental incompatibilities and is consistent with the overall dependency management strategy in the repository.

packages/config/package.json (1)

13-28: DevDependencies Explicit Versioning
This hunk replaces catalog-style versioning with explicit versions (using caret notation where appropriate) for ESLint, Prettier, and related tools. This not only improves clarity but also allows minor updates for non-breaking changes. Overall, the change is well aligned with the dependency management improvements seen across the project.

packages/graphql/package.json (3)

16-23: GraphQL Dependencies Updated
All key dependencies—graphql, graphql-ws, isomorphic-ws, js-cookie, react-relay, relay-connection-handler-plus, relay-runtime, and relay-test-utils—have been updated to explicit versions. This clear specification will help ensure that the GraphQL utilities behave consistently across environments.


26-27: Uniform Peer Dependency for React
With the update to "react": "18.3.1" in peerDependencies, this package now matches the version expected in other packages. Consistency here reduces integration headaches.


32-39: DevDependencies for GraphQL Tools
The explicit version updates for various type definitions and tools (including relay-compiler and typescript) provide better build predictability and a more stable development environment.

packages/authentication/package.json (3)

17-22: Authentication Dependencies Upgrade
Updating dependencies such as @hookform/resolvers, @tanstack/react-query, jotai, js-cookie, react-hook-form, and zod to specific versions removes ambiguity from the build process and aligns this package with the versioning strategy used elsewhere in the repository.


25-27: Peer Dependency Revision for React
The update of the react peer dependency to "18.3.1" ensures that both the authentication package and its consumers are in sync with the version across the codebase.


33-47: DevDependencies Consolidation
Specifying explicit versions for testing libraries, type definitions, and build tools (such as @faker-js/faker, @testing-library packages, babel-jest, jest, ts-jest, etc.) minimizes the risk of version-related issues during development and tests. This is a strong move toward consistency and stability in your development environment.

packages/utils/package.json (4)

17-18: Core Dependency Updates in Utils
Changing axios to version "1.7.2" along with updating dependencies such as expo-constants and expo-secure-store provides a more predictable dependency landscape. Explicit versioning here reduces uncertainty across different environments.


20-21: Critical Library Version Updates and Caution on Canary Release
Updates to dependencies like js-cookie, lodash, luxon, next, react-hook-form, react-native, and zustand now use explicit versions. Note that while using "14.3.0-canary.24" for next might be acceptable if bleeding-edge features are required, this version should be monitored to avoid potential production instability.


34-35: Consistent Peer Dependency for React
The peer dependency update for react to "18.3.1" maintains consistency with changes in other packages and should help prevent version mismatch issues.


40-57: DevDependencies Alignment for Utils
The explicit version updates for testing libraries and TypeScript-related tools add extra stability and transparency to your development process. By moving away from catalog references, you significantly reduce unexpected version shifts during development or CI builds.

packages/wagtail/package.json (3)

22-28: Explicit Dependency Versions Set in Dependencies Section

The dependency versions have been updated from catalog references to fixed versions (e.g. "@mui/material": "5.15.19", "axios": "1.7.2", etc.). This enhances clarity and reproducibility of builds. Please double-check that these versions are fully compatible with other packages in the ecosystem.


34-34: Updated Peer Dependency for React

The peer dependency for React is now set to "18.3.1". Ensure that this version aligns with the expectations across all consuming packages.


37-84: Updated DevDependencies with Explicit Version Numbers

All devDependencies (e.g. Babel presets, Storybook addons, Cypress, TypeScript, and Webpack tools) have been updated to specific version numbers. This is great for consistency. It would be beneficial to verify that these updates do not introduce any incompatibilities during local builds or testing.

packages/components/package.json (3)

24-50: Explicit Dependency Versions in Components Package

The dependencies have been updated with explicit version numbers (e.g. "@emotion/cache": "11.11.0", "@mui/material": "5.15.19", "react-hook-form": "7.51.5", etc.). This update improves version traceability and build reproducibility. Please ensure that these versions remain consistent with those used in related packages across the repository.


56-57: Peer Dependencies Version Update

The peerDependencies for React and ReactDOM are now "18.3.1". Confirm that this upgrade harmonizes with the other packages consuming React to avoid potential rendering or lifecycle issues.


60-121: Comprehensive Update of DevDependencies

The devDependencies block now lists explicit versions for a wide range of tools including Babel, Storybook, Cypress, Jest, and Webpack. The consistency across these toolchain versions is beneficial; however, it is advisable to run the full test suite to ensure that none of these version bumps introduce unexpected side effects in development or CI.

packages/components/schema.graphql (4)

157-160: New Input Type for Deleting Chat Messages

The input type ChatRoomDeleteMessageInput is added with required id and an optional clientMutationId. This aligns with the deletion functionality described in the PR objectives. Consider adding a descriptive comment for documentation purposes if this schema is publicly exposed.


162-168: New Output Type for Chat Message Deletion

The addition of ChatRoomDeleteMessagePayload provides a structured response for the deletion mutation, including error details and the deleted message edge. This is consistent with other mutation payload definitions in the schema.


665-666: Augmenting the Message Type with a Deleted Flag

A new field deleted: Boolean! has been added to the Message type. This flag is critical to implement the display behavior for deleted messages (showing different texts for the deleter and others). Please verify that all client queries using this fragment properly handle this field.


717-717: Introducing the chatRoomDeleteMessage Mutation

The mutation chatRoomDeleteMessage(input: ChatRoomDeleteMessageInput!): ChatRoomDeleteMessagePayload is added to the Mutation type. This update meets the PR’s objective for implementing chat message deletion. Ensure that the corresponding resolver implements the proper behavior (updating message text, triggering a toast notification, etc.).

Copy link
Collaborator

@tsl-ps2 tsl-ps2 left a comment

Choose a reason for hiding this comment

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

Left some minor comments

@pt-tsl pt-tsl force-pushed the BA-2211-delete-chat-message branch from dc76a75 to 8d4fe5f Compare February 7, 2025 14:46
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (2)
packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (2)

32-49: ⚠️ Potential issue

Fix error handling and success notification.

The message deletion implementation has several issues:

  1. Success notification uses 'error' type instead of 'success'
  2. Error handling is missing

Apply this diff to fix the issues:

  const [commitUpdate, isMutationInFlight] = useMessageDeleteMutation()

  const onDeleteClick = async () => {
    if (isMutationInFlight) return

    commitUpdate({
      variables: {
        input: {
          id: message.id,
        },
      },
      onCompleted: (response, errors) => {
        if (!errors) {
-         sendToast('Your message was deleted', { type: 'error' })
+         sendToast('Your message was deleted', { type: 'success' })
+       } else {
+         sendToast('Failed to delete message', { type: 'error' })
+         console.error('Delete message error:', errors)
        }
      },
+     onError: (error) => {
+       sendToast('Failed to delete message', { type: 'error' })
+       console.error('Delete message error:', error)
+     },
    })
  }

114-115: ⚠️ Potential issue

Update loading state and remove TODO comment.

The loading state is not reflected in the UI, and there's an unnecessary TODO comment.

Apply this diff to fix the issues:

-      handleDeleteItem={() => onDeleteClick()} // TODO: Implement delete message
-      isDeletingItem={false}
+      handleDeleteItem={() => onDeleteClick()}
+      isDeletingItem={isMutationInFlight}
🧹 Nitpick comments (4)
packages/components/schema.graphql (4)

157-160: Add Documentation for New Input Type "ChatRoomDeleteMessageInput".
The new input type successfully defines the required id field and optional clientMutationId used for the delete operation. For maintainability and clarity, consider adding descriptive comments (docstrings) for the type and its fields (e.g., “Input for deleting a chat message”) to ensure consistent documentation across schema types.


162-168: Review the "ChatRoomDeleteMessagePayload" Definition.
The payload type is defined with standard fields such as errors, _debug, deletedMessage, and clientMutationId. Like the input type, adding a brief docstring describing the purpose of this payload (e.g., “Payload returned after attempting to delete a chat message”) would improve understandability for future maintainers.


665-666: Clarify the "deleted" Field in the Message Type.
A new field "deleted: Boolean!" has been added to the Message type to indicate whether a message is deleted. Consider adding an explanatory docstring (for example, “Indicates if the message has been deleted; true if deleted, false otherwise”) to align with the clarity of the rest of the schema.


193-195: Review New Type "ChatRoomOnMessage".
The new type “ChatRoomOnMessage” (with a single field "message: MessageEdge") likely serves as a subscription payload for message deletion events. Consider adding a short description to the type and its field to clarify its purpose, for example indicating that it is used to notify subscribers of a change to a specific message.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc76a75 and 8d4fe5f.

⛔ Files ignored due to path filters (2)
  • packages/components/__generated__/useMessagesListSubscription.graphql.ts is excluded by !**/__generated__/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (4 hunks)
  • packages/components/modules/messages/graphql/subscriptions/useMessagesListSubscription.tsx (1 hunks)
  • packages/components/schema.graphql (5 hunks)
🔇 Additional comments (4)
packages/components/modules/messages/graphql/subscriptions/useMessagesListSubscription.tsx (1)

7-7: LGTM! Subscription field updated to handle all message events.

The change from chatRoomOnNewMessage to chatRoomOnMessage appropriately broadens the subscription scope to handle all message events, including deletions, which aligns with the PR's message deletion functionality.

Let's verify that this subscription field exists in the schema:

✅ Verification successful

🏁 Script executed:

#!/bin/bash
# Description: Verify the subscription field exists in the schema
# Expected: The field should be defined in the schema

# Search for the subscription field definition
rg -A 5 "type Subscription" .

Length of output: 565


LGTM! Verified subscription schema update.
The schema file confirms that the subscription field "chatRoomOnMessage" is defined as expected, which aligns perfectly with broadening the message events scope to include deletions.

packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (1)

77-77: Review spacing in message content.

The space after BlockIcon could affect the layout of non-deleted messages.

Consider moving the space inside the conditional:

-       {deletedMessage ? <BlockIcon sx={{ fontSize: '20px', color: 'grey.500' }} /> : undefined}{' '}
+       {deletedMessage ? <><BlockIcon sx={{ fontSize: '20px', color: 'grey.500' }} /> </> : undefined}
✅ Verification successful

Spacing may affect layout when no deleted message icon is rendered.

The current implementation always appends a space even if deletedMessage is false, which may disrupt the intended layout for non-deleted messages. Consider conditionally including the space only when rendering the BlockIcon to avoid unnecessary spacing.

  • File: packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx
  • Suggestion: Move the space inside the condition to ensure it’s only rendered for deleted messages.
packages/components/schema.graphql (2)

716-718: Verify the Mutation "chatRoomDeleteMessage" Implementation.
The mutation is correctly added to the Mutation type with the appropriate input and payload types. Ensure that the backend resolver logic (and associated authorization checks) correctly processes this mutation as intended by the PR objectives. If not already done, validate that clients calling this mutation receive proper error feedback via the errors field.


197-199: Examine New Type "ChatRoomOnMessagesCountUpdate".
This type currently only includes a field "profile: Profile". Depending on its intended use for real-time updates (for instance towards unread counts or overall message counts), verify that this type includes all necessary information. Adding a descriptive comment on its intended purpose is recommended to ensure that future changes remain aligned with its design.

@pt-tsl pt-tsl force-pushed the BA-2211-delete-chat-message branch from 8d4fe5f to 7364c50 Compare February 7, 2025 15:02
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (1)

45-45: 🛠️ Refactor suggestion

Update success message to match design requirements.

The success message should be "Message Deleted" according to the PR objectives, not "Your message was deleted".

-          sendToast('Your message was deleted', { type: 'error' })
+          sendToast('Message Deleted', { type: 'success' })
🧹 Nitpick comments (3)
packages/components/schema.graphql (3)

157-160: Consider adding description for ChatRoomDeleteMessageInput.

Add documentation comments to describe the purpose and usage of this input type, similar to other types in the schema.

+"""
+Input type for deleting a message in a chat room.
+"""
 input ChatRoomDeleteMessageInput {
+  """The ID of the message to delete."""
   id: ID!
+  """Optional client mutation ID."""
   clientMutationId: String
 }

162-168: Consider adding description for ChatRoomDeleteMessagePayload.

Add documentation comments to describe the purpose and fields of this payload type.

+"""
+Payload type returned after deleting a message in a chat room.
+"""
 type ChatRoomDeleteMessagePayload {
   """May contain more than one error for same field."""
   errors: [ErrorType]
   _debug: DjangoDebug
+  """The deleted message."""
   deletedMessage: MessageEdge
+  """Optional client mutation ID."""
   clientMutationId: String
 }

665-665: Consider adding description for the deleted field.

Add a documentation comment to describe the purpose of the deleted field in the Message type.

+  """Indicates whether the message has been deleted."""
   deleted: Boolean!
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8d4fe5f and 7364c50.

⛔ Files ignored due to path filters (3)
  • packages/components/__generated__/MessageDeleteMutation.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/useMessagesListSubscription.graphql.ts is excluded by !**/__generated__/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (4)
  • packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (4 hunks)
  • packages/components/modules/messages/graphql/mutations/MessageDelete.ts (1 hunks)
  • packages/components/modules/messages/graphql/subscriptions/useMessagesListSubscription.tsx (1 hunks)
  • packages/components/schema.graphql (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/components/modules/messages/graphql/subscriptions/useMessagesListSubscription.tsx
  • packages/components/modules/messages/graphql/mutations/MessageDelete.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (1)
packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (1)

77-79: Verify spacing in deleted message display.

The space after BlockIcon was questioned in past reviews. Please clarify if this spacing is intentional and matches the design requirements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/components/CHANGELOG.md (1)

3-7: Enhance the changelog entry to better reflect the scope of changes.

The current entry could be more descriptive about the implemented features. Consider expanding it to:

- Enabled chat room messages deletion
+ Enabled chat room messages deletion:
+   - Added message deletion via three-dot menu overlay
+   - Implemented deletion confirmation dialogs
+   - Added deleted message states
+   - Integrated toast notifications for deletions
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7364c50 and 71d0a2a.

📒 Files selected for processing (2)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/components/package.json

@pt-tsl pt-tsl force-pushed the BA-2211-delete-chat-message branch from 71d0a2a to 48631a6 Compare February 11, 2025 23:33
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (1)

45-45: ⚠️ Potential issue

Use 'success' toast type for successful deletion.

The toast notification uses 'error' type for a successful deletion, which may confuse users.

-          sendToast('Your message was deleted', { type: 'error' })
+          sendToast('Your message was deleted', { type: 'success' })
🧹 Nitpick comments (1)
packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (1)

92-92: Track unimplemented features.

There are TODO comments for unimplemented features:

  • Copy message functionality
  • Download attachments functionality

Consider creating issues to track these features if they're planned for future implementation.

Would you like me to help create issues for tracking these features?

Also applies to: 109-109

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71d0a2a and 48631a6.

⛔ Files ignored due to path filters (11)
  • packages/components/__generated__/ActivityLogsFragment.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ActivityLogsPaginationQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ActivityLogsQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ChatRoomMessagesListPaginationQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/ChatRoomQuery.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/MessageDeleteMutation.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/MessageItemFragment.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/MessageUpdateMutation.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/SendMessageMutation.graphql.ts is excluded by !**/__generated__/**
  • packages/components/__generated__/useMessagesListSubscription.graphql.ts is excluded by !**/__generated__/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (11)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/__shared__/ActionsOverlay/index.tsx (4 hunks)
  • packages/components/modules/__shared__/ActionsOverlay/types.ts (2 hunks)
  • packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (4 hunks)
  • packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts (1 hunks)
  • packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/index.tsx (1 hunks)
  • packages/components/modules/messages/graphql/fragments/MessageItem.ts (1 hunks)
  • packages/components/modules/messages/graphql/mutations/MessageDelete.ts (1 hunks)
  • packages/components/modules/messages/graphql/subscriptions/useMessagesListSubscription.tsx (1 hunks)
  • packages/components/package.json (1 hunks)
  • packages/components/schema.graphql (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts
  • packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/index.tsx
  • packages/components/CHANGELOG.md
  • packages/components/modules/messages/graphql/fragments/MessageItem.ts
  • packages/components/modules/messages/graphql/subscriptions/useMessagesListSubscription.tsx
  • packages/components/modules/shared/ActionsOverlay/types.ts
  • packages/components/modules/shared/ActionsOverlay/index.tsx
  • packages/components/package.json
  • packages/components/modules/messages/graphql/mutations/MessageDelete.ts
  • packages/components/schema.graphql
🔇 Additional comments (1)
packages/components/modules/messages/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (1)

77-78: Explain spacing after BlockIcon.

The space after the BlockIcon is intentional to provide visual separation between the icon and the "message deleted" text. This follows standard UI practices for icon-text combinations.

@pt-tsl pt-tsl force-pushed the BA-2211-delete-chat-message branch from 48631a6 to 1973a0f Compare February 12, 2025 00:46
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts (1)

24-50: LGTM! Robust error handling in custom hook.

The useMessageDeleteMutation hook implementation:

  • Returns mutation commit function and loading state
  • Properly handles errors with toast notifications
  • Maintains original config callbacks

However, consider adding JSDoc comments to document the hook's parameters and return values.

Add documentation:

+/**
+ * Hook for deleting chat room messages
+ * @returns [commitMutation, isMutationInFlight]
+ * - commitMutation: Function to execute the delete mutation
+ * - isMutationInFlight: Boolean indicating if mutation is in progress
+ */
 export const useMessageDeleteMutation = (): [
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 48631a6 and 1973a0f.

⛔ Files ignored due to path filters (1)
  • packages/components/__generated__/MessageDeleteMutation.graphql.ts is excluded by !**/__generated__/**
📒 Files selected for processing (7)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/index.tsx (5 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/types.ts (2 hunks)
  • packages/components/modules/messages/common/graphql/fragments/MessageItem.ts (1 hunks)
  • packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts (1 hunks)
  • packages/components/modules/messages/common/graphql/subscriptions/useMessagesListSubscription.tsx (1 hunks)
  • packages/components/modules/messages/common/index.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/components/CHANGELOG.md
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Build and Lint Packages
🔇 Additional comments (8)
packages/components/modules/messages/common/graphql/fragments/MessageItem.ts (1)

8-8: LGTM! Added deleted field for message deletion status.

The addition of the deleted field to MessageItemFragment aligns with the PR objectives and enables tracking of message deletion status for UI display.

packages/components/modules/messages/common/graphql/subscriptions/useMessagesListSubscription.tsx (1)

7-7: LGTM! Renamed subscription to handle all message events.

The subscription name change from chatRoomOnNewMessage to chatRoomOnMessage better reflects its broader scope of handling all message events, including deletions.

packages/components/modules/__shared__/web/ActionsOverlay/types.ts (1)

30-30: LGTM! Added props for delete functionality control.

The new props enhance the ActionOverlayProps interface:

  • disableDelete: Allows conditional control over delete action
  • DeleteDialogProps: Enables customization of the confirmation dialog

Both props are optional, maintaining backward compatibility.

Also applies to: 33-33

packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts (1)

7-22: LGTM! Well-structured GraphQL mutation.

The mutation is correctly structured with:

  • Input validation through ChatRoomDeleteMessageInput
  • Proper error handling fields
  • Fragment reuse for message data
packages/components/modules/messages/common/index.ts (1)

10-11: LGTM!

The new exports for message deletion and update mutations are correctly placed and follow the established pattern in the file.

packages/components/modules/__shared__/web/ActionsOverlay/index.tsx (3)

27-33: LGTM!

The new props disableDelete and DeleteDialogProps are well-defined with appropriate default values. These additions enhance the component's flexibility for message deletion scenarios.


169-179: LGTM!

The delete button changes are well-implemented:

  • Correctly handles both loading and disabled states
  • Uses simplified "Delete" text as per design requirements

99-116: Update dialog content to match requirements.

The current implementation uses a generic confirmation message, but the PR requirements specify different messages for individual and group chats.

Please ensure that the DeleteDialogProps passed from the parent component includes the appropriate content based on the chat type.

Example usage:

const dialogProps = {
  content: isGroupChat 
    ? "Are you sure you want to delete this message? All members in this group will no longer see it."
    : "Are you sure you want to delete this message? The other person will no longer see it."
};

@pt-tsl pt-tsl force-pushed the BA-2211-delete-chat-message branch 2 times, most recently from 9c57ad3 to aeaaca2 Compare February 13, 2025 18:04
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (5)
packages/components/modules/__shared__/web/ActionsOverlay/__storybook__/ActionsOverlay.mdx (1)

49-49: Enhance example usage.

While the example correctly uses the new showDeleteButton prop, consider enhancing it to:

  1. Demonstrate the new disableDeleteButton prop
  2. Show a more relevant example aligned with the chat message deletion use case

Apply this diff to improve the example:

       title='Button',
-      showDeleteButton={true}
+      showDeleteButton={true}
+      disableDeleteButton={false}
       handleDeleteItem={() => {}}

Additionally, consider adding a second example specifically for chat message deletion:

export const ChatMessageActionsOverlay = () => {
  const [isDeleting, setIsDeleting] = React.useState(false);
  
  const handleDelete = async () => {
    setIsDeleting(true);
    // Simulated deletion
    await new Promise(resolve => setTimeout(resolve, 1000));
    setIsDeleting(false);
  };

  return (
    <ActionsOverlay
      title='Message'
      showDeleteButton={true}
      disableDeleteButton={isDeleting}
      isDeletingItem={isDeleting}
      handleDeleteItem={handleDelete}
    >
      <div>Example chat message</div>
    </ActionsOverlay>
  );
};
packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/index.tsx (2)

28-28: Enhance accessibility with more descriptive aria-label.

The current aria-label "delete item" is generic. Consider making it more descriptive to improve accessibility.

-        aria-label="delete item"
+        aria-label="delete message"

24-32: Add tooltip to delete button.

Consider adding a tooltip to the delete button to enhance user experience, similar to how it's done for other action buttons.

     {showDeleteButton && (
       <IconButton
         onClick={handleDeleteDialogOpen}
         disabled={isDeletingItem || disableDeleteButton}
-        aria-label="delete message"
+        aria-label="delete message"
+        title="Delete message"
       >
         <TrashCanIcon />
       </IconButton>
     )}
packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/index.tsx (1)

58-72: Enhance delete button accessibility.

The delete menu item implementation looks good, but could benefit from improved accessibility.

Consider these accessibility enhancements:

 <MenuItem
   onClick={handleDeleteDialogOpen}
   disabled={isDeletingItem || disableDeleteButton}
   color="disabled"
+  aria-label="Delete message"
+  role="menuitem"
 >
   <TrashCanIcon sx={{ color: disableDeleteButton ? 'text.disabled' : 'error.main' }} />
   <Typography
     variant="body2"
     color={disableDeleteButton ? 'text.disabled' : 'error.main'}
+    aria-hidden="true"
   >
     Delete
   </Typography>
 </MenuItem>
packages/components/schema.graphql (1)

1-1821: Consider these architectural points for the implementation.

Based on the PR objectives, ensure the implementation includes:

  1. UI Components:

    • Confirmation dialog with different messages for individual vs group chats
    • Toast notification using the existing info icon and timed snack-bar
    • Gray font styling for deleted message text
  2. State Management:

    • Track message deletion state using the new deleted field
    • Update UI immediately on successful deletion
    • Handle optimistic updates for better UX
  3. Error Handling:

    • Handle network errors during deletion
    • Show appropriate error messages in the toast
    • Revert optimistic updates on failure
  4. Accessibility:

    • Ensure the delete button is keyboard accessible
    • Add appropriate ARIA labels
    • Maintain focus management during confirmation dialog
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1973a0f and aeaaca2.

⛔ Files ignored due to path filters (2)
  • packages/components/__generated__/MessageDeleteMutation.graphql.ts is excluded by !**/__generated__/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/index.tsx (2 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/types.ts (1 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/index.tsx (2 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/types.ts (1 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/__storybook__/ActionsOverlay.mdx (2 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/index.tsx (6 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/types.ts (2 hunks)
  • packages/components/modules/comments/web/CommentItem/index.tsx (1 hunks)
  • packages/components/modules/messages/common/graphql/fragments/MessageItem.ts (1 hunks)
  • packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts (1 hunks)
  • packages/components/modules/messages/common/graphql/subscriptions/useMessagesListSubscription.tsx (1 hunks)
  • packages/components/modules/messages/common/index.ts (1 hunks)
  • packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx (1 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (3 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts (1 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/index.tsx (1 hunks)
  • packages/components/package.json (1 hunks)
  • packages/components/schema.graphql (71 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • packages/components/modules/messages/common/graphql/fragments/MessageItem.ts
  • packages/components/modules/messages/common/graphql/subscriptions/useMessagesListSubscription.tsx
  • packages/components/package.json
  • packages/components/modules/messages/common/index.ts
  • packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts
  • packages/components/CHANGELOG.md
  • packages/components/modules/shared/web/ActionsOverlay/types.ts
  • packages/components/modules/shared/web/ActionsOverlay/index.tsx
🔇 Additional comments (13)
packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/types.ts (1)

6-11: LGTM! Props updated to support message deletion functionality.

The interface changes align well with the PR objectives by adding showDeleteButton and disableDeleteButton props to control the delete button's visibility and state.

packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts (1)

8-8: LGTM! Added prop to support group chat functionality.

The optional isGroup prop enables different delete confirmation messages for group vs individual chats, as specified in the PR objectives.

packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/types.ts (1)

8-13: LGTM! Props updated consistently with DefaultHoverOverlay.

The interface changes maintain consistency with DefaultHoverOverlay by using the same props (showDeleteButton and disableDeleteButton) to control the delete button's visibility and state.

packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/index.tsx (1)

12-14: LGTM! Delete button implementation aligns with requirements.

The implementation correctly uses the new props to control the delete button's visibility and disabled state.

Also applies to: 24-32

packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/index.tsx (1)

15-17: LGTM! Props refactoring improves clarity.

The prop renaming from enableDelete to showDeleteButton and addition of disableDeleteButton makes the component's API more intuitive and consistent with the PR objectives.

packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/index.tsx (1)

100-100: LGTM! Proper propagation of group chat context.

The isGroup prop is correctly passed to MessageItem, enabling contextual delete confirmation messages.

packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (2)

66-68: LGTM! Proper styling for deleted messages.

The color change for deleted messages aligns with the design requirements.


81-83: LGTM! Clear visual indication of deleted messages.

The BlockIcon and spacing provide a clear visual indication of deleted messages.

packages/components/modules/comments/web/CommentItem/index.tsx (1)

130-130: LGTM! Consistent prop naming across components.

The prop rename from enableDelete to showDeleteButton maintains consistency with other components.

packages/components/schema.graphql (4)

157-160: LGTM! Input type is well-defined.

The ChatRoomDeleteMessageInput type correctly requires the message ID and includes an optional clientMutationId.


162-168: LGTM! Output type handles errors appropriately.

The ChatRoomDeleteMessagePayload type includes:

  • Error handling via errors field
  • Debug information
  • The deleted message edge
  • Client mutation ID for tracking

665-665: LGTM! Message type updated correctly.

The deleted field addition to the Message type enables proper tracking of message deletion state.


717-717: LGTM! Mutation is properly defined.

The chatRoomDeleteMessage mutation is correctly added to the schema with proper input and output types.

@pt-tsl pt-tsl force-pushed the BA-2211-delete-chat-message branch 2 times, most recently from 25a1670 to 8fb8dfa Compare February 14, 2025 13:25
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (1)

38-53: ⚠️ Potential issue

Fix toast notification type and enhance error handling.

The toast notification uses 'error' type for a successful deletion, which is incorrect.

Apply this fix:

 const onDeleteClick = async () => {
   if (isMutationInFlight) return

   commitUpdate({
     variables: {
       input: {
         id: message.id,
       },
     },
     onCompleted: (response, errors) => {
-      if (!errors) {
-        sendToast('Your message was deleted', { type: 'error' })
+      if (errors?.length) {
+        sendToast('Failed to delete message', { type: 'error' })
+        return
       }
+      sendToast('Your message was deleted', { type: 'info' })
     },
+    onError: (error) => {
+      console.error('Delete message error:', error)
+      sendToast('Failed to delete message', { type: 'error' })
+    }
   })
 }
🧹 Nitpick comments (3)
packages/components/schema.graphql (1)

665-665: Add description for the deleted field.

The deleted field in the Message type should have a description documenting its purpose.

+  """Indicates whether the message has been deleted."""
   deleted: Boolean!
packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts (1)

33-47: Enhance error handling in the mutation.

The error handling could be more specific and provide better user feedback.

 const commit = (config: UseMutationConfig<MessageDeleteMutation>) =>
   commitMutation({
     ...config,
     onCompleted: (response, errors) => {
+      if (response.chatRoomDeleteMessage?.errors?.length) {
+        response.chatRoomDeleteMessage.errors.forEach((error) => {
+          sendToast(`Failed to delete message: ${error.messages.join(', ')}`, { type: 'error' })
+        })
+        return
+      }
       errors?.forEach((error) => {
         sendToast(error.message, { type: 'error' })
       })

       config?.onCompleted?.(response, errors)
     },
     onError: (error) => {
-      sendToast(error.message, { type: 'error' })
+      sendToast('Failed to delete message. Please try again.', { type: 'error' })
+      console.error('Delete message error:', error)
       config?.onError?.(error)
     },
   })
packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (1)

81-83: Add aria-label for deleted message icon.

The BlockIcon needs an aria-label for better accessibility.

-{deletedMessage && <BlockIcon sx={{ fontSize: '20px', color: 'grey.500' }} />}
+{deletedMessage && (
+  <BlockIcon
+    sx={{ fontSize: '20px', color: 'grey.500' }}
+    aria-label="Message deleted"
+  />
+)}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between aeaaca2 and 25a1670.

⛔ Files ignored due to path filters (2)
  • packages/components/__generated__/MessageDeleteMutation.graphql.ts is excluded by !**/__generated__/**
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/index.tsx (2 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/types.ts (1 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/index.tsx (2 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/types.ts (1 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/__storybook__/ActionsOverlay.mdx (2 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/index.tsx (6 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/types.ts (2 hunks)
  • packages/components/modules/comments/web/CommentItem/index.tsx (1 hunks)
  • packages/components/modules/messages/common/graphql/fragments/MessageItem.ts (1 hunks)
  • packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts (1 hunks)
  • packages/components/modules/messages/common/graphql/subscriptions/useMessagesListSubscription.tsx (1 hunks)
  • packages/components/modules/messages/common/index.ts (1 hunks)
  • packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx (1 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (4 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts (1 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/index.tsx (1 hunks)
  • packages/components/package.json (1 hunks)
  • packages/components/schema.graphql (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (16)
  • packages/components/package.json
  • packages/components/CHANGELOG.md
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts
  • packages/components/modules/messages/common/graphql/fragments/MessageItem.ts
  • packages/components/modules/shared/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/types.ts
  • packages/components/modules/comments/web/CommentItem/index.tsx
  • packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx
  • packages/components/modules/shared/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/index.tsx
  • packages/components/modules/shared/web/ActionsOverlay/storybook/ActionsOverlay.mdx
  • packages/components/modules/shared/web/ActionsOverlay/DefaultHoverOverlay/types.ts
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/index.tsx
  • packages/components/modules/shared/web/ActionsOverlay/index.tsx
  • packages/components/modules/messages/common/graphql/subscriptions/useMessagesListSubscription.tsx
  • packages/components/modules/messages/common/index.ts
  • packages/components/modules/shared/web/ActionsOverlay/types.ts
  • packages/components/modules/shared/web/ActionsOverlay/DefaultHoverOverlay/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Build and Lint Packages
🔇 Additional comments (8)
packages/components/schema.graphql (6)

157-160: LGTM! Input type is well-defined.

The ChatRoomDeleteMessageInput type is correctly structured with required message ID and optional clientMutationId.


162-168: LGTM! Payload type follows best practices.

The ChatRoomDeleteMessagePayload type follows GraphQL best practices by including:

  • Error handling through the errors field
  • Debug information
  • The deleted message as an edge type
  • Client mutation ID for optimistic updates

1666-1666: LGTM! Subscription rename reflects broader scope.

The subscription rename from chatRoomOnNewMessage to chatRoomOnMessage better reflects its broader scope of handling all message-related events.


157-168: LGTM! Well-structured mutation types for message deletion.

The input and payload types follow GraphQL best practices and maintain consistency with other mutations in the schema:

  • Input type correctly requires message ID
  • Payload includes standard error handling
  • Returns deleted message as an edge for proper cursor-based pagination

665-665: LGTM! Message type correctly updated for deletion status.

The addition of the required deleted boolean field aligns with the PR objectives, enabling different message displays for deleted content.


1666-1666: LGTM! Subscription naming improved for better semantics.

The rename from chatRoomOnNewMessage to chatRoomOnMessage better reflects its broader scope of handling all message events, including deletions.

packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts (1)

7-22: LGTM! Well-structured GraphQL mutation.

The mutation is well-structured with proper input validation and includes the MessageItemFragment for consistent data shape.

packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (1)

121-127: LGTM! Delete button implementation follows requirements.

The delete button implementation correctly:

  • Shows only for own messages
  • Disables for deleted messages
  • Includes confirmation dialog with context-aware message

@pt-tsl pt-tsl force-pushed the BA-2211-delete-chat-message branch from b18899e to 473e062 Compare February 17, 2025 22:52
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (1)

38-53: ⚠️ Potential issue

Enhance error handling and fix toast type.

The current implementation has two issues:

  1. Using 'error' toast type for successful deletion
  2. Missing comprehensive error handling

Apply this fix:

 const onDeleteClick = async () => {
   if (isMutationInFlight) return

   commitUpdate({
     variables: {
       input: {
         id: message.id,
       },
     },
     onCompleted: (response, errors) => {
-      if (!errors) {
-        sendToast('Your message was deleted', { type: 'error' })
+      if (errors?.length) {
+        sendToast('Failed to delete message', { type: 'error' })
+        return
       }
+      sendToast('Your message was deleted', { type: 'info' })
     },
+    onError: (error) => {
+      console.error('Delete message error:', error)
+      sendToast('Failed to delete message', { type: 'error' })
+    }
   })
 }
🧹 Nitpick comments (1)
packages/components/schema.graphql (1)

162-168: Payload Type for Deletion Mutation

The added ChatRoomDeleteMessagePayload type is well structured. It includes fields for capturing errors, debugging data, and returning the deletedMessage as a MessageEdge, along with the clientMutationId. Consider documenting the nullability of deletedMessage to clarify its expected state when the deletion operation fails.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 25a1670 and 473e062.

📒 Files selected for processing (22)
  • packages/components/CHANGELOG.md (1 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/index.tsx (2 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/DefaultHoverOverlay/types.ts (1 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/index.tsx (2 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/types.ts (1 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/__storybook__/ActionsOverlay.mdx (2 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/__storybook__/stories.tsx (2 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/index.tsx (6 hunks)
  • packages/components/modules/__shared__/web/ActionsOverlay/types.ts (2 hunks)
  • packages/components/modules/comments/web/CommentItem/index.tsx (1 hunks)
  • packages/components/modules/messages/common/graphql/fragments/MessageItem.ts (1 hunks)
  • packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts (1 hunks)
  • packages/components/modules/messages/common/graphql/subscriptions/useMessagesListSubscription.tsx (1 hunks)
  • packages/components/modules/messages/common/index.ts (1 hunks)
  • packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx (1 hunks)
  • packages/components/modules/messages/web/ChatRoomsList/index.tsx (5 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/SystemMessage/styled.tsx (1 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (4 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts (1 hunks)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/index.tsx (1 hunks)
  • packages/components/package.json (1 hunks)
  • packages/components/schema.graphql (5 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/SystemMessage/styled.tsx
🚧 Files skipped from review as they are similar to previous changes (16)
  • packages/components/CHANGELOG.md
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/types.ts
  • packages/components/package.json
  • packages/components/modules/messages/common/graphql/fragments/MessageItem.ts
  • packages/components/modules/messages/common/graphql/subscriptions/useMessagesListSubscription.tsx
  • packages/components/modules/comments/web/CommentItem/index.tsx
  • packages/components/modules/shared/web/ActionsOverlay/DefaultHoverOverlay/index.tsx
  • packages/components/modules/shared/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/types.ts
  • packages/components/modules/shared/web/ActionsOverlay/DefaultHoverOverlay/types.ts
  • packages/components/modules/messages/common/index.ts
  • packages/components/modules/shared/web/ActionsOverlay/storybook/ActionsOverlay.mdx
  • packages/components/modules/messages/web/ChatRoomsList/ChatRoomItem/index.tsx
  • packages/components/modules/shared/web/ActionsOverlay/ThreeDotsMenuHoverOverlay/index.tsx
  • packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/index.tsx
  • packages/components/modules/messages/common/graphql/mutations/MessageDelete.ts
  • packages/components/modules/shared/web/ActionsOverlay/types.ts
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Build and Lint Packages
  • GitHub Check: Component Test Packages
🔇 Additional comments (12)
packages/components/modules/__shared__/web/ActionsOverlay/__storybook__/stories.tsx (1)

22-22: LGTM!

The prop renaming from enableDelete to showDeleteButton is consistent with the component's updated API.

Also applies to: 45-45

packages/components/modules/messages/web/MessagesList/MessagesGroup/UserMessage/MessageItem/index.tsx (2)

64-68: LGTM!

Good implementation of message color handling for deleted state.


55-57: LGTM!

Well-implemented dynamic delete dialog content that adapts based on chat type.

packages/components/modules/messages/web/ChatRoomsList/index.tsx (3)

96-101: LGTM!

Well-documented workaround for the Virtuoso component's endReached event bug. The solution to remount the component is clean and effective.


56-63: LGTM!

Good addition of network-only fetch policy to ensure fresh data is fetched when searching or changing tabs.

Also applies to: 70-77, 85-92


151-160: LGTM!

Clean refactoring of empty state handling with simplified conditional logic.

packages/components/modules/__shared__/web/ActionsOverlay/index.tsx (2)

25-28: LGTM!

Good improvements to the component's API:

  • More semantic prop names (showDeleteButton instead of enableDelete)
  • Granular control over delete button state with disableDeleteButton
  • Enhanced dialog customization with DeleteDialogProps

Also applies to: 33-33


177-177: LGTM!

Good simplification of the delete button label to just "Delete" instead of including the title.

packages/components/schema.graphql (4)

157-160: Input Type for Deletion Mutation

The new ChatRoomDeleteMessageInput is defined correctly with a required id and an optional clientMutationId. This structure aligns with the Relay mutation pattern.


665-665: Deletion Flag on Message Type

The addition of the deleted: Boolean! field in the Message type enables tracking the deletion state of messages. Please ensure that your resolvers correctly update this flag so that the UI can distinguish between "You deleted this message" and "This message was deleted." for other users.


717-717: Addition of Delete Mutation

The mutation chatRoomDeleteMessage(input: ChatRoomDeleteMessageInput!): ChatRoomDeleteMessagePayload is now part of the Mutation type. Make sure that the backend resolver correctly implements the deletion logic, updates the message’s status, and returns the expected payload.


193-195: Renaming of Subscription for Message Events

The new type ChatRoomOnMessage replaces the previous subscription name (chatRoomOnNewMessage). This renaming broadens the event scope and should be reflected consistently in the subscription resolvers and client-side consumers.

@pt-tsl pt-tsl force-pushed the BA-2211-delete-chat-message branch from 473e062 to 34b9312 Compare February 18, 2025 11:56
@anicioalexandre anicioalexandre merged commit 1f6b8ec into master Feb 18, 2025
8 checks passed
@anicioalexandre anicioalexandre deleted the BA-2211-delete-chat-message branch February 18, 2025 12:17
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.

4 participants