feat: Introduce draft message indicator - #41355
Conversation
|
Looks like this PR is ready to merge! 🎉 |
🦋 Changeset detectedLatest commit: c005784 The changes in this PR will be included in the next version bump. 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 |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughThis change replaces the Drafts sidebar preview with always-on draft indicators, adds per-thread draft persistence through ChangesThread draft persistence and composer flow
Always-on draft navigation behavior
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant ThreadComposer
participant MessageBox
participant useDraft
participant rooms.saveDraft
participant Subscriptions
ThreadComposer->>MessageBox: provide tmid and threadExists
MessageBox->>useDraft: initialize from threadDrafts[tmid]
useDraft->>rooms.saveDraft: save draft with tmid
rooms.saveDraft->>Subscriptions: update threadDrafts[tmid]
Subscriptions-->>ThreadComposer: publish updated subscription
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (2)
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. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #41355 +/- ##
=========================================
Coverage 68.64% 68.65%
=========================================
Files 4139 4139
Lines 159115 159146 +31
Branches 27900 28043 +143
=========================================
+ Hits 109232 109260 +28
+ Misses 44748 44741 -7
- Partials 5135 5145 +10
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
apps/meteor/server/api/v1/rooms.ts (1)
423-428: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low valueRemove
nullable: trueor update the TypeScript signature to allownull.The JSON schema permits
tmidto benull(nullable: true), but the TypeScript generic<{ ..., tmid?: IMessage['_id'] }>expects it to bestring | undefined. This causes a hidden type mismatch wherethis.bodyParams.tmidcould benullat runtime, which is then passed toupdateDraftByRoomIdAndUserIdthat expectsstring | undefined.Since the client only omits
tmidwhen not saving a thread draft (via...(tmid && { tmid })), you can safely removenullable: true.♻️ Proposed fix
const saveDraftBodySchema = ajv.compile<{ rid: IRoom['_id']; draft: string; tmid?: IMessage['_id'] }>({ type: 'object', properties: { rid: { type: 'string', minLength: 1 }, draft: { type: 'string' }, - tmid: { type: 'string', minLength: 1, nullable: true }, + tmid: { type: 'string', minLength: 1 }, }, required: ['rid', 'draft'], additionalProperties: false, });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/meteor/server/api/v1/rooms.ts` around lines 423 - 428, Remove nullable: true from the tmid property in saveDraftBodySchema so the JSON schema matches the TypeScript signature and updateDraftByRoomIdAndUserId receives only string or undefined.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/meteor/client/views/room/composer/messageBox/hooks/useDraft.ts`:
- Around line 5-11: Keep threadExistsRef synchronized with the threadExists prop
in useDraft by adding an effect that updates the ref whenever threadExists
changes. Preserve the existing ref usage in flushDraft so drafts for newly
created threads continue syncing normally.
---
Nitpick comments:
In `@apps/meteor/server/api/v1/rooms.ts`:
- Around line 423-428: Remove nullable: true from the tmid property in
saveDraftBodySchema so the JSON schema matches the TypeScript signature and
updateDraftByRoomIdAndUserId receives only string or undefined.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 312c07da-4c66-41bc-8726-2c0fe9841807
⛔ Files ignored due to path filters (1)
apps/meteor/public/images/featurePreview/sidebar-drafts.pngis excluded by!**/*.png
📒 Files selected for processing (30)
.changeset/funny-wings-sell.mdapps/meteor/client/lib/utils/getSubscriptionDraft.spec.tsapps/meteor/client/lib/utils/getSubscriptionDraft.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.tsapps/meteor/client/sidebar/Item/Condensed.tsxapps/meteor/client/sidebar/Item/Extended.tsxapps/meteor/client/sidebar/Item/Medium.tsxapps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsxapps/meteor/client/sidebar/hooks/useRoomList.tsapps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsxapps/meteor/client/views/navigation/sidepanel/SidepanelItem/SidepanelItem.tsxapps/meteor/client/views/room/composer/ComposerMessage.tsxapps/meteor/client/views/room/composer/messageBox/MessageBox.tsxapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.tsapps/meteor/client/views/room/contextualBar/Threads/ThreadList.tsxapps/meteor/client/views/room/contextualBar/Threads/components/ThreadChat.tsxapps/meteor/client/views/room/contextualBar/Threads/components/ThreadListItem.tsxapps/meteor/client/views/room/contextualBar/Threads/components/ThreadListMessage.tsxapps/meteor/lib/publishFields.tsapps/meteor/server/api/v1/rooms.tsapps/meteor/server/settings/accounts.tsapps/meteor/tests/end-to-end/api/rooms.tspackages/core-typings/src/ISubscription.tspackages/i18n/src/locales/en.i18n.jsonpackages/i18n/src/locales/pt-BR.i18n.jsonpackages/i18n/src/locales/sv.i18n.jsonpackages/model-typings/src/models/ISubscriptionsModel.tspackages/models/src/models/Subscriptions.tspackages/ui-client/src/hooks/useFeaturePreviewList.ts
💤 Files with no reviewable changes (4)
- packages/i18n/src/locales/pt-BR.i18n.json
- apps/meteor/server/settings/accounts.ts
- packages/i18n/src/locales/sv.i18n.json
- apps/meteor/client/sidebar/hooks/useRoomList.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- GitHub Check: CodeQL-Build
- GitHub Check: CodeQL-Build
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/client/sidebar/Item/Condensed.tsxapps/meteor/client/lib/utils/getSubscriptionDraft.spec.tsapps/meteor/client/views/room/contextualBar/Threads/ThreadList.tsxapps/meteor/client/views/room/contextualBar/Threads/components/ThreadChat.tsxpackages/core-typings/src/ISubscription.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.tsapps/meteor/client/lib/utils/getSubscriptionDraft.tsapps/meteor/tests/end-to-end/api/rooms.tsapps/meteor/lib/publishFields.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.tspackages/models/src/models/Subscriptions.tsapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.tspackages/ui-client/src/hooks/useFeaturePreviewList.tspackages/model-typings/src/models/ISubscriptionsModel.tsapps/meteor/client/views/room/contextualBar/Threads/components/ThreadListItem.tsxapps/meteor/client/sidebar/Item/Extended.tsxapps/meteor/server/api/v1/rooms.tsapps/meteor/client/views/navigation/sidepanel/SidepanelItem/SidepanelItem.tsxapps/meteor/client/views/room/composer/ComposerMessage.tsxapps/meteor/client/views/room/contextualBar/Threads/components/ThreadListMessage.tsxapps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsxapps/meteor/client/sidebar/Item/Medium.tsxapps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsxapps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
**/*.spec.ts
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.spec.ts: Use descriptive test names that clearly communicate expected behavior in Playwright tests
Use.spec.tsextension for test files (e.g.,login.spec.ts)
Files:
apps/meteor/client/lib/utils/getSubscriptionDraft.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.ts
🧠 Learnings (10)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
apps/meteor/client/sidebar/Item/Condensed.tsxapps/meteor/client/views/room/contextualBar/Threads/ThreadList.tsxapps/meteor/client/views/room/contextualBar/Threads/components/ThreadChat.tsxapps/meteor/client/views/room/contextualBar/Threads/components/ThreadListItem.tsxapps/meteor/client/sidebar/Item/Extended.tsxapps/meteor/client/views/navigation/sidepanel/SidepanelItem/SidepanelItem.tsxapps/meteor/client/views/room/composer/ComposerMessage.tsxapps/meteor/client/views/room/contextualBar/Threads/components/ThreadListMessage.tsxapps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsxapps/meteor/client/sidebar/Item/Medium.tsxapps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsxapps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/client/sidebar/Item/Condensed.tsxapps/meteor/client/lib/utils/getSubscriptionDraft.spec.tsapps/meteor/client/views/room/contextualBar/Threads/ThreadList.tsxapps/meteor/client/views/room/contextualBar/Threads/components/ThreadChat.tsxpackages/core-typings/src/ISubscription.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.tsapps/meteor/client/lib/utils/getSubscriptionDraft.tsapps/meteor/tests/end-to-end/api/rooms.tsapps/meteor/lib/publishFields.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.tspackages/models/src/models/Subscriptions.tsapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.tspackages/ui-client/src/hooks/useFeaturePreviewList.tspackages/model-typings/src/models/ISubscriptionsModel.tsapps/meteor/client/views/room/contextualBar/Threads/components/ThreadListItem.tsxapps/meteor/client/sidebar/Item/Extended.tsxapps/meteor/server/api/v1/rooms.tsapps/meteor/client/views/navigation/sidepanel/SidepanelItem/SidepanelItem.tsxapps/meteor/client/views/room/composer/ComposerMessage.tsxapps/meteor/client/views/room/contextualBar/Threads/components/ThreadListMessage.tsxapps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsxapps/meteor/client/sidebar/Item/Medium.tsxapps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsxapps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.
Applied to files:
apps/meteor/client/lib/utils/getSubscriptionDraft.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.tsapps/meteor/client/lib/utils/getSubscriptionDraft.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.tsapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.
Applied to files:
apps/meteor/client/lib/utils/getSubscriptionDraft.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.tsapps/meteor/client/lib/utils/getSubscriptionDraft.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.tsapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.ts
📚 Learning: 2026-02-24T19:22:48.358Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/omnichannel/omnichannel-send-pdf-transcript.spec.ts:66-67
Timestamp: 2026-02-24T19:22:48.358Z
Learning: In Playwright end-to-end tests (e.g., under apps/meteor/tests/e2e/...), prefer locating elements by translated text (getByText) and ARIA roles (getByRole) over data-qa attributes. If translation values change, update the corresponding test locators accordingly. Never use data-qa locators. This guideline applies to all Playwright e2e test specs in the repository and helps keep tests robust to UI text changes and accessible semantics.
Applied to files:
apps/meteor/client/lib/utils/getSubscriptionDraft.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/client/lib/utils/getSubscriptionDraft.spec.tspackages/core-typings/src/ISubscription.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.tsapps/meteor/client/lib/utils/getSubscriptionDraft.tsapps/meteor/tests/end-to-end/api/rooms.tsapps/meteor/lib/publishFields.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.tspackages/models/src/models/Subscriptions.tsapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.tspackages/ui-client/src/hooks/useFeaturePreviewList.tspackages/model-typings/src/models/ISubscriptionsModel.tsapps/meteor/server/api/v1/rooms.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/client/lib/utils/getSubscriptionDraft.spec.tspackages/core-typings/src/ISubscription.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.tsapps/meteor/client/lib/utils/getSubscriptionDraft.tsapps/meteor/tests/end-to-end/api/rooms.tsapps/meteor/lib/publishFields.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.tspackages/models/src/models/Subscriptions.tsapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.tspackages/ui-client/src/hooks/useFeaturePreviewList.tspackages/model-typings/src/models/ISubscriptionsModel.tsapps/meteor/server/api/v1/rooms.ts
📚 Learning: 2026-03-06T18:10:15.268Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 39397
File: packages/gazzodown/src/code/CodeBlock.spec.tsx:47-68
Timestamp: 2026-03-06T18:10:15.268Z
Learning: In tests (especially those using testing-library/dom/jsdom) for Rocket.Chat components, the HTML <code> element has an implicit ARIA role of 'code'. Therefore, screen.getByRole('code') or screen.findByRole('code') will locate <code> elements even without a role attribute. Do not flag findByRole('code') as invalid in reviews; prefer using the implicit role instead of adding role="code" unless necessary for accessibility.
Applied to files:
apps/meteor/client/lib/utils/getSubscriptionDraft.spec.tsapps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.ts
📚 Learning: 2026-03-16T21:50:37.589Z
Learnt from: amitb0ra
Repo: RocketChat/Rocket.Chat PR: 39676
File: .changeset/migrate-users-register-openapi.md:3-3
Timestamp: 2026-03-16T21:50:37.589Z
Learning: For changes related to OpenAPI migrations in Rocket.Chat/OpenAPI, when removing endpoint types and validators from rocket.chat/rest-typings (e.g., UserRegisterParamsPOST, /v1/users.register) document this as a minor changeset (not breaking) per RocketChat/Rocket.Chat-Open-API#150 Rule 7. Note that the endpoint type is re-exposed via a module augmentation .d.ts in the consuming package (e.g., packages/web-ui-registration/src/users-register.d.ts). In reviews, ensure the changeset clearly states: this is a non-breaking change, the major version should not be bumped, and the changeset reflects a minor version bump. Do not treat this as a breaking change during OpenAPI migrations.
Applied to files:
.changeset/funny-wings-sell.md
📚 Learning: 2026-01-19T18:08:05.314Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38169
File: packages/ui-client/src/hooks/useGoToDirectMessage.ts:20-27
Timestamp: 2026-01-19T18:08:05.314Z
Learning: Rule of Hooks: In React, hooks (including custom hooks like useGoToDirectMessage and useUserSubscriptionByName) must be called unconditionally and in the same order on every render. Do not conditionally call hooks based on values; instead, derive safe inputs if a value may be undefined (e.g., pass an empty string or undefined) and handle variations in logic outside the hook invocation. This preserves hook order and avoids violations. Apply this guideline to all files under packages/ui-client/src/hooks where hooks are used.
Applied to files:
packages/ui-client/src/hooks/useFeaturePreviewList.ts
🔇 Additional comments (24)
packages/core-typings/src/ISubscription.ts (1)
69-69: LGTM!packages/model-typings/src/models/ISubscriptionsModel.ts (1)
1-1: LGTM!Also applies to: 142-147
packages/models/src/models/Subscriptions.ts (1)
644-648: LGTM!apps/meteor/lib/publishFields.ts (1)
43-43: LGTM!apps/meteor/tests/end-to-end/api/rooms.ts (1)
184-229: LGTM!apps/meteor/client/views/room/composer/ComposerMessage.tsx (1)
12-24: LGTM!apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx (1)
135-140: LGTM!apps/meteor/client/views/room/contextualBar/Threads/components/ThreadChat.tsx (1)
116-116: LGTM!apps/meteor/client/lib/utils/getSubscriptionDraft.ts (1)
1-9: LGTM!apps/meteor/client/lib/utils/getSubscriptionDraft.spec.ts (1)
1-22: LGTM!apps/meteor/client/views/navigation/sidepanel/SidepanelItem/RoomSidePanelItem.tsx (1)
2-2: LGTM!Also applies to: 14-14, 43-46, 68-68
apps/meteor/client/views/navigation/sidepanel/SidepanelItem/SidepanelItem.tsx (1)
22-22: LGTM!Also applies to: 37-37, 77-77
apps/meteor/client/views/room/contextualBar/Threads/ThreadList.tsx (1)
180-180: LGTM!apps/meteor/client/views/room/contextualBar/Threads/components/ThreadListItem.tsx (1)
17-21: LGTM!Also applies to: 63-63
apps/meteor/client/views/room/contextualBar/Threads/components/ThreadListMessage.tsx (1)
11-17: LGTM!Also applies to: 40-40, 59-62, 75-75
packages/i18n/src/locales/en.i18n.json (1)
1929-1929: LGTM!Also applies to: 5608-5609
apps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.ts (1)
8-15: LGTM!apps/meteor/client/lib/utils/normalizeMessagePreview/getMessagePreview.spec.ts (1)
19-58: LGTM!apps/meteor/client/sidebar/RoomList/SidebarItemTemplateWithData.tsx (1)
2-2: LGTM!Also applies to: 12-12, 95-98, 133-133, 203-208
apps/meteor/client/sidebar/Item/Condensed.tsx (1)
22-30: LGTM!apps/meteor/client/sidebar/Item/Extended.tsx (1)
45-45: LGTM!Also applies to: 66-66
apps/meteor/client/sidebar/Item/Medium.tsx (1)
21-29: LGTM!packages/ui-client/src/hooks/useFeaturePreviewList.ts (1)
3-3: LGTM!Also applies to: 28-31
.changeset/funny-wings-sell.md (1)
1-10: LGTM!
There was a problem hiding this comment.
All reported issues were addressed across 31 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
82340f3 to
67b8a06
Compare
Also keep threadExistsRef in sync with the threadExists prop so flushDraft respects thread existence changes after mount. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ba05fd6 to
b4a750d
Compare
Co-authored-by: Kevin Aleman <kaleman960@gmail.com>
There was a problem hiding this comment.
can you check this behavior and maybe add a test to it?
Thread draft gets stuck after the last reply is deleted
Steps to reproduce
- Create a thread with one reply
- Type another reply, but don’t send it
- Close the thread so the draft is saved and the pencil appears
- Click on "View thread"
- Delete the last thread reply
- Clear the restored draft and close the thread again
- Click on "View thread" again
Expected: The persisted draft should be removed after clearing it.
Actual: The pencil remains and the cleared draft comes back.
It's small but still worth checking it
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/meteor/client/views/room/composer/messageBox/hooks/useDraft.ts`:
- Around line 48-54: Update the draft-save logic in useDraft so the
draft===serverValueRef.current path clears the local draft before returning.
Move the serverValueRef update until saveDraft resolves successfully, and ensure
rejected saves leave the local draft intact and do not advance the server
reference so the value can be retried.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 626dee47-7bb2-48f9-894f-4066a4622ce6
📒 Files selected for processing (7)
apps/meteor/client/views/room/composer/ComposerMessage.tsxapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.spec.tsxapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.tsapps/meteor/client/views/room/contextualBar/Threads/components/ThreadChat.tsxapps/meteor/server/api/v1/rooms.tsapps/meteor/server/settings/accounts.tsapps/meteor/tests/end-to-end/api/rooms.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- apps/meteor/server/settings/accounts.ts
- apps/meteor/server/api/v1/rooms.ts
- apps/meteor/tests/end-to-end/api/rooms.ts
- apps/meteor/client/views/room/composer/messageBox/hooks/useDraft.spec.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
- GitHub Check: cubic · AI code reviewer
- GitHub Check: Hacktron Security Check
- GitHub Check: CodeQL-Build
⚠️ CI failures not shown inline (5)
GitHub Check: Dionisio QA: Some checks did not pass
Conclusion: failure
**Conclusion:** failure
### Steps
- ❌ **No merge conflicts** — This PR has conflicts, please resolve them before merging
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ❌ **Mergeable** — This PR is not mergeable
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
GitHub Check: Dionisio QA: Some checks did not pass
Conclusion: failure
**Conclusion:** failure
### Steps
- ❌ **No merge conflicts** — This PR has conflicts, please resolve them before merging
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ❌ **Mergeable** — This PR is not mergeable
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
GitHub Check: Dionisio QA: Some checks did not pass
Conclusion: failure
**Conclusion:** failure
### Steps
- ✅ **No merge conflicts**
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ✅ **Mergeable**
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
GitHub Check: Dionisio QA: Some checks did not pass
Conclusion: failure
**Conclusion:** failure
### Steps
- ❌ **No merge conflicts** — This PR has conflicts, please resolve them before merging
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ❌ **Mergeable** — This PR is not mergeable
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
GitHub Check: Dionisio QA: Some checks did not pass
Conclusion: failure
**Conclusion:** failure
### Steps
- ❌ **No merge conflicts** — This PR has conflicts, please resolve them before merging
- ❌ **QA assured** — This PR is missing the 'stat: QA assured' label
- ❌ **Mergeable** — This PR is not mergeable
- ❌ **Has milestone or project** — This PR is missing the required milestone or project
- ✅ **Valid PR title**
- ✅ **Correct target version**
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/client/views/room/contextualBar/Threads/components/ThreadChat.tsxapps/meteor/client/views/room/composer/ComposerMessage.tsxapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.ts
🧠 Learnings (6)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
apps/meteor/client/views/room/contextualBar/Threads/components/ThreadChat.tsxapps/meteor/client/views/room/composer/ComposerMessage.tsx
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/client/views/room/contextualBar/Threads/components/ThreadChat.tsxapps/meteor/client/views/room/composer/ComposerMessage.tsxapps/meteor/client/views/room/composer/messageBox/hooks/useDraft.ts
📚 Learning: 2026-02-10T16:32:42.586Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38528
File: apps/meteor/client/startup/roles.ts:14-14
Timestamp: 2026-02-10T16:32:42.586Z
Learning: In Rocket.Chat's Meteor client code, DDP streams use EJSON and Date fields arrive as Date objects; do not manually construct new Date() in stream handlers (for example, in sdk.stream()). Only REST API responses return plain JSON where dates are strings, so implement explicit conversion there if needed. Apply this guidance to all TypeScript files under apps/meteor/client to ensure consistent date handling in DDP streams and REST responses.
Applied to files:
apps/meteor/client/views/room/composer/messageBox/hooks/useDraft.ts
📚 Learning: 2026-05-11T20:30:35.265Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 40480
File: apps/meteor/client/meteor/startup/accounts.ts:59-61
Timestamp: 2026-05-11T20:30:35.265Z
Learning: In Rocket.Chat’s Meteor client code, when calling `dispatchToastMessage` with `{ type: 'error' }`, pass the raw caught error object as `message` without manual normalization. `dispatchToastMessage` is designed to accept `message: unknown` for error toasts, so avoid converting errors to strings (e.g., `String(error)`) or extracting `error.message` before passing them.
Applied to files:
apps/meteor/client/views/room/composer/messageBox/hooks/useDraft.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In the Rocket.Chat repository, do not reference Biome lint rules in code review feedback. Biome is not used even if biome.json exists; only reference Biome rules if there is explicit, project-wide usage documented. For TypeScript files, review lint implications without Biome guidance unless the project enables Biome rules.
Applied to files:
apps/meteor/client/views/room/composer/messageBox/hooks/useDraft.ts
📚 Learning: 2026-02-26T19:25:44.063Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 38778
File: packages/ui-voip/src/providers/useMediaSession.ts:192-192
Timestamp: 2026-02-26T19:25:44.063Z
Learning: In this repository (RocketChat/Rocket.Chat), Biome lint rules are not used even if a biome.json exists. When reviewing TypeScript files (e.g., packages/ui-voip/src/providers/useMediaSession.ts), ensure lint suggestions do not reference Biome-specific rules. Rely on general ESLint/TypeScript lint rules and project conventions instead.
Applied to files:
apps/meteor/client/views/room/composer/messageBox/hooks/useDraft.ts
🔇 Additional comments (2)
apps/meteor/client/views/room/contextualBar/Threads/components/ThreadChat.tsx (1)
2-2: LGTM!Also applies to: 116-116
apps/meteor/client/views/room/composer/ComposerMessage.tsx (1)
13-14: LGTM!Also applies to: 91-91
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
5c93685 to
9434fc9
Compare
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Re-trigger cubic
Proposed changes (including videos or screenshots)
Replaces the experimental "Drafts in sidebar" feature preview with a first-class, always-on draft indicator, and extends draft support to threads.
Previously, rooms with an unfinished message were grouped into a separate Drafts sidebar category, gated behind a feature preview. That preview is removed. Instead, any room with a draft is now marked inline with a pencil icon and its unfinished text is surfaced in the message preview — no category, no preview toggle. Thread-composer drafts are now also persisted and indicated, which they weren't before
Threads
tmid, so an unfinished reply also flags the room and is restored across devices. Drafts for not-yet-created threads stay local only, so they don't flag a room for a thread that can't be opened from the thread list.How to test
Issue(s)
Steps to test or reproduce
Further comments
Summary by CodeRabbit
Summary by CodeRabbit
CORE-81
CORE-2414