Repository navigation
feat(ui-message-list): add message contexts and content parts - #43724
gabriellsh wants to merge 12 commits into
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
🦋 Changeset detectedLatest commit: 5917e63 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## message-list/02-list-fixes #43724 +/- ##
==============================================================
+ Coverage 71.23% 71.30% +0.06%
==============================================================
Files 5567 5624 +57
Lines 247891 250477 +2586
Branches 46427 46723 +296
==============================================================
+ Hits 176597 178606 +2009
- Misses 66907 67493 +586
+ Partials 4387 4378 -9
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
The message components' specs and stories need messages that are the same on every run. Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Ten contexts carry what the message components need from the app, each with a default that works without a provider. mockMessageProviders wraps a component in all of them with spies for tests. ui-message-list message-capabilities R1-R7 Co-Authored-By: Claude <noreply@anthropic.com>
Body and markdown, reactions with their tooltip, URL previews, a shared location, action links, thread, discussion and broadcast metrics, and collapsible parts. Attachments are not included; the collapsible brings the download and size controls it shows. The reaction tooltip asks for the message by its emoji and the people who reacted, so a reaction added later is named with real names on the next hover. The first stories come with the Storybook play test script, which runs in UTC as CI does. ui-message-list message-capabilities R8-R25 Co-Authored-By: Claude <noreply@anthropic.com>
MessagesProvider gives the ui-message-list message components what they take from the app: settings and preferences, the router, the chat and its composer, modals, REST calls, the markdown, UiKit and emoji renderers and the selection. The toolbar, media and editing values arrive with the parts that read them. The old list provider mounts it, so the display context agrees with the old list context, and GazzodownText reads highlights and real names from it. Reacting keeps the base's guard: no reaction and no picker without a user. The messages the reaction tooltip fetches are keyed by the emoji and the people who reacted, so someone who reacts after a first hover, with this or another emoji, is named on the next one. Departure from the plan: the old list provider mounts the whole MessagesProvider with its own room and subscription, instead of a display-only bridge. It gives the same agreement (R33) and mounts the provider at every list at once. ui-message-list message-capabilities R14, R26-R31, R33 Co-Authored-By: Claude <noreply@anthropic.com>
…ists The threads list, audit, moderation's reported messages, contact history, the forward, pin and report modals and the composer's quote render message parts, so each gets a MessagesProvider; the read-only ones take no interaction. These places now follow the viewer's display settings, as the lists do. The threads list, the audit, moderation, contact history, the modals and the composer's quote highlight the viewer's highlight words; moderation, contact history and the audit show real names in mentions; the audit parses hex colors and KaTeX as the settings say; the attachments of the audit, moderation, contact history and the forward modal take the viewer's media preferences and are sized and linked as in the lists. This was decided by the user at review. A changeset records it. useNormalizedMessage now reads the message content of MessagesProvider, so its own spec goes; MessagesProvider's spec proves the same cases. ui-message-list message-capabilities R32, R36, R37, R38, R39 Co-Authored-By: Claude <noreply@anthropic.com>
The message variants, the attachments, the threads list's metrics and the places that show a message body outside a list read the body, ignored content, fallback, reactions, URL previews, location, action links and metrics from ui-message-list. The app's copies stay until nothing reads them. ui-message-list message-capabilities R34 Co-Authored-By: Claude <noreply@anthropic.com>
The app's copies of the body, ignored content, fallback, reactions, URL previews, location, action links and metrics go, with the hooks only they used and the fields of the old list context only they read. Attachments keep the collapsible, download and map parts they still import. Also deleted: components/message/content/actions/MessageAction.tsx and MessageAction.stories.tsx, which nothing imported any more. The specs of the deleted URL previews and reaction tooltip go with them; the package's specs prove the same cases. The spacing baseline drops the deleted files. Departure from the plan: the switch to the package parts and the deletion of the copies are two commits, so each stands on its own. ui-message-list message-capabilities, retired R35 Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
abf2e82 to
5917e63
Compare
Proposed changes (including videos or screenshots)
Adds the first real code of
@rocket.chat/ui-message-list: the ten message contexts (display, navigation, interactions, toolbar, renderers, related data, content, media, selection and editing), each with a working default, and the message content parts that are not attachments (markdown body, reactions with their tooltip, URL previews, location, action links, thread, discussion and broadcast metrics, collapsible, ignored content). On the app side it addsMessagesProvider, which supplies those contexts from the app, and switches the app's message variants to the package's content parts. The app's copies of those parts are deleted.Because the old lists stay until later parts,
MessagesProvideris mounted whereverMessageListProvideris, and in every place that renders message parts outside a list (audit, moderation, contact history, modals, the composer's quote), read-only ones withallowsInteraction={false}. The old list context stays in agreement with the new display context.Twelve commits: intent, spec and plan; a fixture; a refactor that extracts how a message is normalized; the package contexts and content; the provider; the mounts; the switch; the deletion; docs.
Spacing in the package's parts uses the spacing scale tokens. The two entries of
scripts/spacing-scale/baseline.jsonfor app files this PR deletes (MessageActions.tsx,OEmbedPreviewContent.tsx) go with them. The specsdevelopadded in #43386 for the URL previews, the reaction tooltip and the message normalization are ported into the package's specs and the provider's.The package gains its
test-storybookscript, run underTZ=UTC, with its first stories.This is part 03 of the stack (00 to 09). Review it against its base branch
message-list/02-list-fixes, not againstdevelop.Stack
Visible changes
.changeset/read-only-messages-follow-display-settings.md,'@rocket.chat/meteor': minor: messages in audits, moderation reports, contact history, the forward, pin and report dialogs, the composer's quote and the threads list now highlight the viewer's highlight words; audits, moderation reports and contact history show real names in mentions when real names are on; audits render hex colors and KaTeX as the settings say; attachments in audits, moderation reports, contact history and the forward dialog follow the viewer's media preferences, sized at 360 pixels and linked from the server's address as in rooms.Known differences from develop
Besides the read-only look above (kept on purpose, see the spec):
data-titleattribute is no longer passed;allowsInteraction, so a place that allows none shows no follow control;Issue(s)
Steps to test or reproduce
In a room, check that all of these look and behave as on
develop:Read-only places (new look, named in the changeset):
Further comments
Decisions to check
RoomMessageContent.tsxgoes from complexity 41 to 42 (limit 31), a warning that was already there.@rocket.chat/ui-message-list. This PR adds none for the private package; parts 08 and 09 of the stack do. The repo versions private packages (other private packages carry changesets), so 08 and 09 follow the repo, and 03 to 07 may need changesets too. Undecided.Not run
🤖 Generated with Claude Code