Skip to content

feat: Add draft message badge in sidebar#40216

Open
Polinarr60 wants to merge 2 commits intoRocketChat:developfrom
moevm:feat/draft-message-badge
Open

feat: Add draft message badge in sidebar#40216
Polinarr60 wants to merge 2 commits intoRocketChat:developfrom
moevm:feat/draft-message-badge

Conversation

@Polinarr60
Copy link
Copy Markdown

@Polinarr60 Polinarr60 commented Apr 18, 2026

Proposed changes (including videos or screenshots)

Added draft message badge in sidebar. Users can now see which rooms have unsaved messages with a visual "Draft" badge.

  • Created useRoomDraft hook to detect draft messages in localStorage
  • Added DraftBadge component
  • Integrated draft indicator into both old and new sidebar navigation
  • Added real-time updates when drafts are created or removed
  • Added i18n translations
  • Created getMessageBoxStorageKey utility to avoid code duplication for message namings

Issue(s)

Closes #40215

Steps to test or reproduce

  1. Open any room
  2. Type a message but don't send it
  3. Switch to another room
  4. Check that "Draft" badge appears next to the room with unsaved message

Further comments

Summary by CodeRabbit

  • New Features

    • Added a draft message indicator badge in the sidebar to mark rooms with unsent draft content.
  • Improvements

    • Composer drafts now persist and update the sidebar in real time (including across open windows/tabs), so draft state stays visible and current.
  • Localization

    • Added English translations for draft-related labels and messages.

@Polinarr60 Polinarr60 requested a review from a team as a code owner April 18, 2026 20:22
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Apr 18, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 18, 2026

🦋 Changeset detected

Latest commit: 2f05320

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 42 packages
Name Type
@rocket.chat/i18n Minor
@rocket.chat/meteor Minor
@rocket.chat/mock-providers Patch
@rocket.chat/ui-contexts Major
@rocket.chat/web-ui-registration Major
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/ui-client Major
@rocket.chat/ui-voip Major
@rocket.chat/uikit-playground Patch
@rocket.chat/gazzodown Major
@rocket.chat/livechat Patch
@rocket.chat/ui-avatar Major
@rocket.chat/ui-video-conf Major
@rocket.chat/queue-worker Patch
@rocket.chat/core-typings Minor
@rocket.chat/rest-typings Minor
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/http-router Patch
@rocket.chat/model-typings Patch
@rocket.chat/models Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/presence-service Patch
@rocket.chat/abac Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/license Patch
@rocket.chat/media-calls Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch Patch

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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fb5a8845-f6b7-4aa3-80c7-07e124e83266

📥 Commits

Reviewing files that changed from the base of the PR and between 5c933db and 2f05320.

📒 Files selected for processing (2)
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/client/sidebar/badges/DraftBadge.tsx
✅ Files skipped from review due to trivial changes (1)
  • apps/meteor/client/sidebar/badges/DraftBadge.tsx
📜 Recent review details
🧰 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/app/ui-message/client/messageBox/createComposerAPI.ts
🧠 Learnings (13)
📓 Common learnings
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 39545
File: apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts:59-61
Timestamp: 2026-03-11T22:04:20.529Z
Learning: In `apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts`, the `msg.u._id === uid` early-return in the `streamNewMessage` handler is intentional: the "New messages" indicator is designed to notify about messages from other users only. Self-sent messages — including those sent from a different session/device — are always skipped, by design. Do not flag this as a multi-session regression.
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-03-20T13:51:23.302Z
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 39553
File: apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts:179-181
Timestamp: 2026-03-20T13:51:23.302Z
Learning: In `apps/meteor/app/integrations/server/methods/incoming/updateIncomingIntegration.ts`, the truthiness guards `...(integration.avatar && { avatar })`, `...(integration.emoji && { emoji })`, `...(integration.alias && { alias })`, and `...(integration.script && { script })` in the `$set` payload of `updateIncomingIntegration` are intentional. Empty-string values for these fields should NOT overwrite the stored value — only truthy values are persisted. Do not flag these as bugs preventing explicit clears.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-04-18T12:32:50.305Z
Learnt from: rodrigok
Repo: RocketChat/Rocket.Chat PR: 38623
File: apps/meteor/app/lib/server/functions/cleanRoomHistory.ts:146-149
Timestamp: 2026-04-18T12:32:50.305Z
Learning: In `apps/meteor/app/lib/server/functions/cleanRoomHistory.ts` (PR `#38623`), the read-receipt cleanup (both `ReadReceipts.removeByMessageIds` and `ReadReceiptsArchive.removeByMessageIds`) is intentionally only performed in the limited prune path (`limit && selectedMessageIds`). The unlimited/delete-all path (`limit === 0`) deliberately skips cleaning up orphaned read receipts in both hot and cold storage — this is by design. Do not flag this as a bug or missing cleanup in future reviews.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-03-11T22:04:20.529Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 39545
File: apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts:59-61
Timestamp: 2026-03-11T22:04:20.529Z
Learning: In `apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts`, the `msg.u._id === uid` early-return in the `streamNewMessage` handler is intentional: the "New messages" indicator is designed to notify about messages from other users only. Self-sent messages — including those sent from a different session/device — are always skipped, by design. Do not flag this as a multi-session regression.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-04-17T18:33:24.670Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39858
File: apps/meteor/tests/e2e/apps/uikit-interactions.spec.ts:123-151
Timestamp: 2026-04-17T18:33:24.670Z
Learning: In RocketChat/Rocket.Chat (`apps/meteor/tests/e2e/apps/uikit-interactions.spec.ts`), `executeBlockActionHandler` invocations originating from a **modal** surface intentionally do NOT include a `block_action_room` (room property) in the interaction payload. Modals are not scoped to a room, so no room id is available in that context. Do not flag the absence of a room assertion in the modal block-action test as a missing coverage bug; instead, document it explicitly with a `test.step` asserting the room entry is `undefined`.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-02-24T19:16:35.307Z
Learnt from: sampaiodiego
Repo: RocketChat/Rocket.Chat PR: 39003
File: apps/meteor/client/lib/chats/flows/sendMessage.ts:39-45
Timestamp: 2026-02-24T19:16:35.307Z
Learning: In apps/meteor/client/lib/chats/flows/sendMessage.ts, when sdk.call('sendMessage', ...) throws an error, the message is intentionally left with temp: true (not deleted or cleaned up) to support a future retry UI feature. This allows users to retry sending failed messages rather than losing them.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-04-10T22:42:05.539Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 40075
File: apps/meteor/client/views/room/modals/FileUploadModal/FileUploadModal.tsx:69-71
Timestamp: 2026-04-10T22:42:05.539Z
Learning: In `apps/meteor/client/views/room/modals/FileUploadModal/FileUploadModal.tsx`, the submit handler converts an empty/whitespace-only description to `undefined` (`description?.trim() || undefined`) intentionally. All downstream image-rendering components (`AttachmentImage`, `ImagePreview`, `ImageItem`, `ImageGallery`) default `undefined` alt to `''`, so the `<img alt="">` attribute is always present. Do not flag this `undefined` conversion as a bug preventing alt text from being cleared.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-04-17T17:38:12.974Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39858
File: packages/ui-kit/src/interactions/UserInteraction.ts:33-33
Timestamp: 2026-04-17T17:38:12.974Z
Learning: In RocketChat/Rocket.Chat (`packages/ui-kit/src/interactions/UserInteraction.ts`), `ViewSubmitUserInteraction` and `ViewClosedUserInteraction` intentionally do NOT include `rid` when the interaction originates from a **modal** surface. Modals are not scoped to a room, so no room id is available in that context. The `rid?: string` field is optional to support the contextual bar surface (where room context exists) while remaining absent for modals. Do not flag the absence of `rid` in modal viewSubmit/viewClosed interactions as a missing-context bug.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-02-24T19:36:55.089Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
📚 Learning: 2026-04-10T21:17:22.932Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 40096
File: apps/meteor/ee/server/apps/lib/redactor.ts:3-17
Timestamp: 2026-04-10T21:17:22.932Z
Learning: In RocketChat/Rocket.Chat, `X-User-Id` / `x-user-id` headers must NOT be added to redaction paths in apps log redaction (e.g., `apps/meteor/ee/server/apps/lib/redactor.ts`). The maintainer (d-gubert) has confirmed that X-User-Id is an identifier, not a credential — its presence in logs is useful for diagnostics, and `X-Auth-Token` is the only header that constitutes a real secret. Do not suggest redacting X-User-Id in future reviews of this area.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.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/app/ui-message/client/messageBox/createComposerAPI.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/app/ui-message/client/messageBox/createComposerAPI.ts
🔇 Additional comments (1)
apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts (1)

45-50: LGTM!

Event payload correctly limits detail to { key: storageID }, matching the consumer in useRoomDraft.ts and avoiding broadcasting draft content.


Walkthrough

Adds a sidebar draft indicator: new storage-key utility, a hook to detect drafts via storage events, a badge component, event emission from the composer, sidebar integrations, and English localization strings for draft labels.

Changes

Cohort / File(s) Summary
Versioning & Localization
.changeset/soft-berries-deliver.md, packages/i18n/src/locales/en.i18n.json
Bumped i18n/meteor packages and added English strings: Draft, Draft_message, __draftMessage__from__roomTitle__.
Storage Key Utility
apps/meteor/client/lib/utils/getMessageBoxStorageKey.ts
Added getMessageBoxStorageKey(roomId, tmid?) to centralize messagebox storage key construction.
Composer persistence
apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts, apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
Composer now emits a window CustomEvent named localStorageChange when it writes/removes the draft; MessageBox switched to using the new getMessageBoxStorageKey.
Draft detection hook
apps/meteor/client/sidebar/hooks/useRoomDraft.ts
Added useRoomDraft(roomId) using useSyncExternalStore; listens to native storage and custom localStorageChange events and reports whether a non-empty draft exists.
Badge UI
apps/meteor/client/sidebar/badges/DraftBadge.tsx
New DraftBadge React component (localized, warning variant, role="status") with optional roomTitle prop.
Sidebar integration
apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx, apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx
Both sidebar badge components now import useRoomDraft and conditionally render DraftBadge when a draft is present.

Sequence Diagram

sequenceDiagram
    participant User
    participant MessageBox as MessageBox Component
    participant Window as Window (Events)
    participant Hook as useRoomDraft Hook
    participant Sidebar as Sidebar (Badge)
    User->>MessageBox: Type draft message
    MessageBox->>MessageBox: Debounced persist to storage
    MessageBox->>Window: Dispatch CustomEvent localStorageChange { key }
    Window->>Hook: localStorageChange / storage event received
    Hook->>Hook: Read storage via getMessageBoxStorageKey
    Hook->>Sidebar: Emit update (showDraft=true)
    Sidebar->>Sidebar: Render DraftBadge
    Sidebar->>User: Display draft indicator
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat: Add draft message badge in sidebar' directly and clearly summarizes the main change: adding a visual draft indicator in the sidebar.
Linked Issues check ✅ Passed The PR implements all required functionality for issue #40215: useRoomDraft hook detects draft messages, DraftBadge component displays visual indicator, real-time updates via storage events, and i18n translations are included.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the draft message indicator feature. The getMessageBoxStorageKey utility refactoring and storage event dispatching are supporting changes for the core feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot added the type: feature Pull requests that introduces new feature label Apr 18, 2026
Copy link
Copy Markdown
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts`:
- Around line 42-50: The persist function currently dispatches a window
CustomEvent 'localStorageChange' with the full draft text (input.value); change
it to only include the storage key to avoid leaking drafts: keep saving/removing
via Accounts.storageLocation.setItem/removeItem (refer to persist, storageID,
Accounts.storageLocation), but when calling window.dispatchEvent(new
CustomEvent('localStorageChange', ...)) pass only { key: storageID } in detail
(omit input.value or set no value field) for both the set and remove branches so
listeners like useRoomDraft get the key but never the draft content.

In `@apps/meteor/client/sidebar/badges/DraftBadge.tsx`:
- Around line 14-16: DraftBadge's aria-label currently always interpolates
roomTitle via t('__draftMessage__from__roomTitle__', { roomTitle }) which
produces an incomplete accessible name when roomTitle is undefined; change the
logic in DraftBadge to fallback to an alternative i18n key or string when
roomTitle is missing (for example use t('__draftMessage__') or
t('__draftMessage__from__roomTitle__', { roomTitle: fallback }) ), i.e.,
conditionally compute the aria-label before rendering (referencing the
aria-label prop, roomTitle variable, DraftBadge component and t(...) call) so
the label is always a complete, meaningful string.

In `@apps/meteor/client/sidebar/hooks/useRoomDraft.ts`:
- Around line 9-29: The hook useRoomDraft only checks the base messagebox key
for room drafts; update handleStorageChange and the draft-read function to
include thread keys generated by getMessageBoxStorageKey(roomId, tmid). Compute
the baseKey = getMessageBoxStorageKey(roomId) and treat any storage events where
e.key === baseKey or e.key?.startsWith(`${baseKey}-`) (and same for
e.detail?.key) as relevant in handleStorageChange, and change the draft getter
to scan Accounts.storageLocation keys: check the baseKey item and any keys that
start with `${baseKey}-`, calling getItem for each and returning true if any
value is non-empty after trim. Use the existing symbols handleStorageChange,
getMessageBoxStorageKey, and Accounts.storageLocation.getItem to locate and
modify the logic.
🪄 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: c812ab48-97ca-44d9-87e9-0a20a162797a

📥 Commits

Reviewing files that changed from the base of the PR and between 24b3671 and 5c933db.

📒 Files selected for processing (9)
  • .changeset/soft-berries-deliver.md
  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/client/lib/utils/getMessageBoxStorageKey.ts
  • apps/meteor/client/sidebar/badges/DraftBadge.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/hooks/useRoomDraft.ts
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
  • packages/i18n/src/locales/en.i18n.json
📜 Review details
🧰 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/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/lib/utils/getMessageBoxStorageKey.ts
  • apps/meteor/client/sidebar/hooks/useRoomDraft.ts
  • apps/meteor/client/sidebar/badges/DraftBadge.tsx
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
🧠 Learnings (22)
📓 Common learnings
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 39545
File: apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts:59-61
Timestamp: 2026-03-11T22:04:20.529Z
Learning: In `apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts`, the `msg.u._id === uid` early-return in the `streamNewMessage` handler is intentional: the "New messages" indicator is designed to notify about messages from other users only. Self-sent messages — including those sent from a different session/device — are always skipped, by design. Do not flag this as a multi-session regression.
📚 Learning: 2026-01-17T01:51:47.764Z
Learnt from: tassoevan
Repo: RocketChat/Rocket.Chat PR: 38219
File: packages/core-typings/src/cloud/Announcement.ts:5-6
Timestamp: 2026-01-17T01:51:47.764Z
Learning: In packages/core-typings/src/cloud/Announcement.ts, the AnnouncementSchema.createdBy field intentionally overrides IBannerSchema.createdBy (object with _id and optional username) with a string enum ['cloud', 'system'] to match existing runtime behavior. This is documented as technical debt with a FIXME comment at apps/meteor/app/cloud/server/functions/syncWorkspace/handleCommsSync.ts:53 and should not be flagged as an error until the runtime behavior is corrected.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/badges/DraftBadge.tsx
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
📚 Learning: 2026-03-11T22:04:20.529Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 39545
File: apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts:59-61
Timestamp: 2026-03-11T22:04:20.529Z
Learning: In `apps/meteor/client/views/room/body/hooks/useHasNewMessages.ts`, the `msg.u._id === uid` early-return in the `streamNewMessage` handler is intentional: the "New messages" indicator is designed to notify about messages from other users only. Self-sent messages — including those sent from a different session/device — are always skipped, by design. Do not flag this as a multi-session regression.

Applied to files:

  • apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx
  • .changeset/soft-berries-deliver.md
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/hooks/useRoomDraft.ts
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
📚 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/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/client/lib/utils/getMessageBoxStorageKey.ts
  • apps/meteor/client/sidebar/hooks/useRoomDraft.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/app/ui-message/client/messageBox/createComposerAPI.ts
  • apps/meteor/client/lib/utils/getMessageBoxStorageKey.ts
  • apps/meteor/client/sidebar/hooks/useRoomDraft.ts
📚 Learning: 2026-02-24T19:36:55.089Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 38493
File: apps/meteor/tests/e2e/page-objects/fragments/home-content.ts:60-82
Timestamp: 2026-02-24T19:36:55.089Z
Learning: In RocketChat/Rocket.Chat e2e tests (apps/meteor/tests/e2e/page-objects/fragments/home-content.ts), thread message preview listitems do not have aria-roledescription="message", so lastThreadMessagePreview locator cannot be scoped to messageListItems (which filters for aria-roledescription="message"). It should remain scoped to page.getByRole('listitem') or mainMessageList.getByRole('listitem').

Applied to files:

  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
📚 Learning: 2026-04-17T17:38:12.974Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39858
File: packages/ui-kit/src/interactions/UserInteraction.ts:33-33
Timestamp: 2026-04-17T17:38:12.974Z
Learning: In RocketChat/Rocket.Chat (`packages/ui-kit/src/interactions/UserInteraction.ts`), `ViewSubmitUserInteraction` and `ViewClosedUserInteraction` intentionally do NOT include `rid` when the interaction originates from a **modal** surface. Modals are not scoped to a room, so no room id is available in that context. The `rid?: string` field is optional to support the contextual bar surface (where room context exists) while remaining absent for modals. Do not flag the absence of `rid` in modal viewSubmit/viewClosed interactions as a missing-context bug.

Applied to files:

  • apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/hooks/useRoomDraft.ts
📚 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/navigation/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/badges/DraftBadge.tsx
  • apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx
📚 Learning: 2025-11-19T18:20:07.720Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: packages/i18n/src/locales/en.i18n.json:918-921
Timestamp: 2025-11-19T18:20:07.720Z
Learning: Repo: RocketChat/Rocket.Chat — i18n/formatting
Learning: This repository uses a custom message formatting parser in UI blocks/messages; do not assume standard Markdown rules. For keys like Call_ended_bold, Call_not_answered_bold, Call_failed_bold, and Call_transferred_bold in packages/i18n/src/locales/en.i18n.json, retain the existing single-asterisk emphasis unless maintainers request otherwise.

Applied to files:

  • .changeset/soft-berries-deliver.md
  • packages/i18n/src/locales/en.i18n.json
📚 Learning: 2026-02-24T19:05:56.710Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.

Applied to files:

  • .changeset/soft-berries-deliver.md
📚 Learning: 2025-11-19T12:32:29.696Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37547
File: packages/i18n/src/locales/en.i18n.json:634-634
Timestamp: 2025-11-19T12:32:29.696Z
Learning: Repo: RocketChat/Rocket.Chat
Context: i18n workflow
Learning: In this repository, new translation keys should be added to packages/i18n/src/locales/en.i18n.json only; other locale files are populated via the external translation pipeline and/or fall back to English. Do not request adding the same key to all locale files in future reviews.

Applied to files:

  • .changeset/soft-berries-deliver.md
  • packages/i18n/src/locales/en.i18n.json
📚 Learning: 2026-02-24T19:09:09.561Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.

Applied to files:

  • .changeset/soft-berries-deliver.md
📚 Learning: 2026-02-24T19:05:56.710Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: In Rocket.Chat PRs, keep feature PRs free of unrelated lockfile-only dependency bumps; prefer reverting lockfile drift or isolating such bumps into a separate "chore" commit/PR, and always use yarn install --immutable with the Yarn version pinned in package.json via Corepack.

Applied to files:

  • .changeset/soft-berries-deliver.md
📚 Learning: 2025-10-28T16:53:42.761Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37205
File: ee/packages/federation-matrix/src/FederationMatrix.ts:296-301
Timestamp: 2025-10-28T16:53:42.761Z
Learning: In the Rocket.Chat federation-matrix integration (ee/packages/federation-matrix/), the createRoom method from rocket.chat/federation-sdk will support a 4-argument signature (userId, roomName, visibility, displayName) in newer versions. Code using this 4-argument call is forward-compatible with planned library updates and should not be flagged as an error.

Applied to files:

  • .changeset/soft-berries-deliver.md
  • apps/meteor/client/sidebar/hooks/useRoomDraft.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/soft-berries-deliver.md
📚 Learning: 2026-04-10T22:42:05.539Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 40075
File: apps/meteor/client/views/room/modals/FileUploadModal/FileUploadModal.tsx:69-71
Timestamp: 2026-04-10T22:42:05.539Z
Learning: In `apps/meteor/client/views/room/modals/FileUploadModal/FileUploadModal.tsx`, the submit handler converts an empty/whitespace-only description to `undefined` (`description?.trim() || undefined`) intentionally. All downstream image-rendering components (`AttachmentImage`, `ImagePreview`, `ImageItem`, `ImageGallery`) default `undefined` alt to `''`, so the `<img alt="">` attribute is always present. Do not flag this `undefined` conversion as a bug preventing alt text from being cleared.

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/badges/DraftBadge.tsx
📚 Learning: 2026-04-18T12:32:50.305Z
Learnt from: rodrigok
Repo: RocketChat/Rocket.Chat PR: 38623
File: apps/meteor/app/lib/server/functions/cleanRoomHistory.ts:146-149
Timestamp: 2026-04-18T12:32:50.305Z
Learning: In `apps/meteor/app/lib/server/functions/cleanRoomHistory.ts` (PR `#38623`), the read-receipt cleanup (both `ReadReceipts.removeByMessageIds` and `ReadReceiptsArchive.removeByMessageIds`) is intentionally only performed in the limited prune path (`limit && selectedMessageIds`). The unlimited/delete-all path (`limit === 0`) deliberately skips cleaning up orphaned read receipts in both hot and cold storage — this is by design. Do not flag this as a bug or missing cleanup in future reviews.

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/hooks/useRoomDraft.ts
📚 Learning: 2026-04-17T18:33:24.670Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 39858
File: apps/meteor/tests/e2e/apps/uikit-interactions.spec.ts:123-151
Timestamp: 2026-04-17T18:33:24.670Z
Learning: In RocketChat/Rocket.Chat (`apps/meteor/tests/e2e/apps/uikit-interactions.spec.ts`), `executeBlockActionHandler` invocations originating from a **modal** surface intentionally do NOT include a `block_action_room` (room property) in the interaction payload. Modals are not scoped to a room, so no room id is available in that context. Do not flag the absence of a room assertion in the modal block-action test as a missing coverage bug; instead, document it explicitly with a `test.step` asserting the room entry is `undefined`.

Applied to files:

  • apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx
  • apps/meteor/client/sidebar/hooks/useRoomDraft.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/lib/utils/getMessageBoxStorageKey.ts
  • apps/meteor/client/sidebar/hooks/useRoomDraft.ts
📚 Learning: 2026-04-13T16:40:55.864Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 40100
File: apps/meteor/client/views/root/MainLayout/EmbeddedPreload.tsx:18-35
Timestamp: 2026-04-13T16:40:55.864Z
Learning: In Rocket.Chat's embedded mode (`?layout=embedded`), route changes are driven by the parent frame reloading the iframe URL, which causes a full remount of the React tree (including `EmbeddedPreload` at `apps/meteor/client/views/root/MainLayout/EmbeddedPreload.tsx`). The component never survives a navigation, so `roomParams` (computed via `useMemo`) is always fresh on mount. A `[router]` singleton as the sole `useMemo` dependency is therefore correct and intentional — do not flag it as a stale-dependency bug in this component.

Applied to files:

  • apps/meteor/client/sidebar/hooks/useRoomDraft.ts
📚 Learning: 2025-11-27T17:56:26.050Z
Learnt from: MartinSchoeler
Repo: RocketChat/Rocket.Chat PR: 37557
File: apps/meteor/client/views/admin/ABAC/AdminABACRooms.tsx:115-116
Timestamp: 2025-11-27T17:56:26.050Z
Learning: In Rocket.Chat, the GET /v1/abac/rooms endpoint (implemented in ee/packages/abac/src/index.ts) only returns rooms where abacAttributes exists and is not an empty array (query: { abacAttributes: { $exists: true, $ne: [] } }). Therefore, in components consuming this endpoint (like AdminABACRooms.tsx), room.abacAttributes is guaranteed to be defined for all returned rooms, and optional chaining before calling array methods like .join() is sufficient without additional null coalescing.

Applied to files:

  • apps/meteor/client/sidebar/hooks/useRoomDraft.ts
📚 Learning: 2025-11-17T22:38:48.631Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37505
File: packages/i18n/src/locales/en.i18n.json:3765-3765
Timestamp: 2025-11-17T22:38:48.631Z
Learning: Rocket.Chat i18n copy: Keep sentence case for the value of "Notification_Desktop_show_voice_calls" in packages/i18n/src/locales/en.i18n.json (“Show desktop notifications for voice calls”) per design directive; do not change to Title Case even if nearby labels differ.

Applied to files:

  • packages/i18n/src/locales/en.i18n.json
🔇 Additional comments (6)
.changeset/soft-berries-deliver.md (1)

1-6: Changeset scope and versioning look correct.

Minor bumps and the description match the feature-level addition without indicating breaking behavior.

apps/meteor/client/lib/utils/getMessageBoxStorageKey.ts (1)

1-3: Utility implementation is clean and correctly typed.

The key format is consistent and the optional thread suffix handling is straightforward.

packages/i18n/src/locales/en.i18n.json (1)

1871-1872: Looks good — draft translation keys are consistent and correctly structured.

These entries cover badge text and room-context phrasing, and the interpolation key format matches existing patterns.

Based on learnings: In this repository, new translation keys should be added to packages/i18n/src/locales/en.i18n.json only; other locale files are populated via the external translation pipeline and/or fall back to English.

Also applies to: 7167-7167

apps/meteor/client/views/room/composer/messageBox/MessageBox.tsx (1)

34-34: LGTM — storage key generation is now centralized.

This keeps the composer persistence key aligned with the sidebar draft detection utility.

Also applies to: 131-131

apps/meteor/client/views/navigation/sidebar/badges/SidebarItemBadges.tsx (1)

5-8: LGTM — draft badge integration is clean.

The new hook and badge are wired without changing the existing unread or invitation badge behavior.

Also applies to: 17-23

apps/meteor/client/sidebar/badges/SidebarItemBadges.tsx (1)

5-9: LGTM — old sidebar path is covered too.

This keeps draft badge behavior consistent between the old and new sidebar badge renderers.

Also applies to: 18-25

Comment thread apps/meteor/app/ui-message/client/messageBox/createComposerAPI.ts Outdated
Comment thread apps/meteor/client/sidebar/badges/DraftBadge.tsx Outdated
Comment thread apps/meteor/client/sidebar/hooks/useRoomDraft.ts
@coderabbitai coderabbitai bot removed the type: feature Pull requests that introduces new feature label Apr 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add draft message indicator in sidebar

1 participant