Open splindsay-92 opened 2 weeks ago
Status | Category | Percentage | Covered / Total |
---|---|---|---|
π’ | Lines | 92.78% (π― 92%) | 2817 / 3036 |
π’ | Statements | 92.78% (π― 92%) | 2817 / 3036 |
π’ | Functions | 92.3% (π― 92%) | 216 / 234 |
π’ | Branches | 93.76% (π― 93%) | 782 / 834 |
File | Stmts | % Branch | % Funcs | % Lines | Uncovered Lines |
---|---|---|---|---|---|
Changed Files | |||||
src/core/chat-api.ts | 100% | 78.94% | 100% | 100% | |
src/core/details-metadata.ts | 0% | 0% | 0% | 0% | 1 |
src/core/message.ts | 100% | 100% | 100% | 100% | |
src/core/messages.ts | 93.67% | 92.45% | 100% | 93.67% | 403-405, 438-442, 454-458, 575-577 |
src/core/metadata.ts | 0% | 0% | 0% | 0% | 1 |
src/react/hooks/use-messages.ts | 84.28% | 94.73% | 14.28% | 84.28% | 120-130 |
The pull request introduces a feature in the Ably Chat SDK that enables users to delete messages. This includes updates to documentation, core functionalities, and components, such as the addition of a delete
method on the room.messages
property. New interfaces for deletion parameters have been created, and modifications to the test suite ensure comprehensive coverage of the deletion functionality.
File Path | Change Summary |
---|---|
README.md | Added section on "Deleting messages" detailing the delete method on room.messages , including parameters and return values. |
demo/src/components/MessageComponent/MessageComponent.tsx | Updated MessageProps to include onMessageDelete method, added hover state and trash icon for message deletion, and modified component signature. |
demo/src/containers/Chat/Chat.tsx | Imported MessageEvents , updated message listener logic to handle created and deleted messages, and added deleteMessage function to the useMessages hook. |
src/core/chat-api.ts | Introduced DeleteMessageParams and DeleteMessageResponse interfaces, added deleteMessage method, and updated getMessages method API endpoint and return fields. |
src/core/index.ts | Added DetailsMetadata and DeleteMessageParams to exports, updated exports from message.js . |
src/core/messages.ts | Added DeleteMessageParams interface, updated MessageEventsMap , and implemented delete method in Messages interface and DefaultMessages class. |
src/react/README.md | Updated documentation for useMessages hook to include deleteMessage method. |
src/react/hooks/use-messages.ts | Added deleteMessage method to UseMessagesResponse interface, implemented using useCallback . |
test/core/chat.integration.test.ts | Updated error message in waitForConnectionLifecycle function. |
test/core/messages.integration.test.ts | Added tests for message deletion and retrieval in history, utilizing MessageEvents enum. |
test/core/messages.test.ts | Added test for deleting messages and improved event handling in tests. |
test/react/hooks/use-messages.integration.test.tsx | Added test for deleting messages, validating deletion and metadata. |
test/react/hooks/use-messages.test.tsx | Updated test case names and added assertions for deleteMessage functionality. |
demo/package.json | Updated ably dependency to a local tarball and added react-icons dependency. |
src/core/details-metadata.ts | Introduced DetailsMetadata type for message metadata. |
src/core/message.ts | Modified Message interface to change isDeleted and isUpdated methods to getter properties. |
test/core/message.test.ts | Added tests for isDeleted and isUpdated properties, changing method calls to property accesses. |
src/core/metadata.ts | Removed DetailsMetadata type declaration. |
test/core/message-parser.test.ts | Added test cases for error handling in parseMessage function for unhandled actions and undefined properties. |
In the chat where messages flow,
A new feature starts to glow.
With a click, the trash can's near,
Deleting words, we shed a tear.
Softly marked, they fade away,
In our hearts, they still may stay. πβ¨
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?
Context
Description
These changes are dependant on both ably-js changes to support the new fields (updated in this PR), and additional realtime work that has not yet been completed.
Once the above is done, the tests should be able to pass, as such, please do not merge this PR until the above is done.
Checklist
Testing Instructions (Optional)
Summary by CodeRabbit
Release Notes
New Features
MessageComponent
to support message deletion with an interactive trash icon.useMessages
hook to include adeleteMessage
method for easier message management.Bug Fixes
Documentation
useMessages
hook to reflect the new message deletion capabilities, including example code.Tests