Skip to content

Conversation

@MartinSchoeler
Copy link
Member

@MartinSchoeler MartinSchoeler commented Jan 20, 2026

Proposed changes (including videos or screenshots)

Issue(s)

SUP-955

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features

    • Encrypted parent rooms now automatically disable the encryption toggle when creating discussions, ensuring child discussions inherit the parent room's encryption status.
    • Added visual indicator (encryption icon) for encrypted rooms in room selection.
  • Tests

    • Added test coverage for discussion creation behavior with encrypted parent rooms.
    • Added Storybook stories for the discussion creation component with mocked API endpoints.

✏️ Tip: You can customize this high-level summary in your review settings.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jan 20, 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

changeset-bot bot commented Jan 20, 2026

⚠️ No Changeset found

Latest commit: 3fd3df5

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

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

Walkthrough

This PR adds support for creating encrypted discussions with an initial message by detecting when the parent room is encrypted, propagating that status to the CreateDiscussion component, and disabling the encryption toggle accordingly. It includes API field exposure, component logic enhancements, test coverage, and integration updates across multiple action handlers.

Changes

Cohort / File(s) Summary
API Query Enhancement
apps/meteor/app/api/server/lib/rooms.ts
Added encrypted field to the findChannelAndPrivateAutocomplete query projection to expose encryption status in autocomplete results.
CreateDiscussion Component
apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx
Added encryptedParentRoom prop to track parent room encryption status. Implemented onParentRoomChange handler to disable encryption toggle and sync encrypted state when a parent room is selected. Enhanced RoomAutoComplete integration with renderRoomIcon to display encryption indicators.
CreateDiscussion Testing & Stories
apps/meteor/client/components/CreateDiscussion/CreateDiscussion.spec.tsx, CreateDiscussion.stories.tsx
Introduced comprehensive test suite covering snapshot and accessibility tests, plus specific test cases for encrypted parent room behavior (verifying toggle and first message field are disabled). Added Storybook story with mocked API endpoints for discussion creation and room info.
RoomAutoComplete Component
apps/meteor/client/components/RoomAutoComplete/RoomAutoComplete.tsx
Updated setSelectedRoom prop signature from Dispatch<SetStateAction<IRoom | undefined>> to (room: IRoom | undefined) => void for better composability. Enhanced renderItem to include optional icon rendering via renderRoomIcon.
Integration Points
apps/meteor/client/components/message/toolbar/useNewDiscussionMessageAction.tsx, apps/meteor/client/views/room/composer/messageBox/MessageBoxActionsToolbar/hooks/useCreateDiscussionAction.tsx
Updated both action handlers to pass encryptedParentRoom={room?.encrypted} prop when invoking CreateDiscussion modal.

Sequence Diagram

sequenceDiagram
    actor User
    participant CreateDiscussion
    participant RoomAutoComplete
    participant API
    participant Form

    User->>CreateDiscussion: Open create discussion modal
    CreateDiscussion->>CreateDiscussion: Initialize with encryptedParentRoom prop
    User->>RoomAutoComplete: Select parent room
    RoomAutoComplete->>API: Fetch room details (with encrypted field)
    API-->>RoomAutoComplete: Return room with encrypted status
    RoomAutoComplete->>CreateDiscussion: onParentRoomChange callback
    CreateDiscussion->>CreateDiscussion: Detect if room is encrypted
    alt Encrypted Parent Room
        CreateDiscussion->>Form: Set encrypted toggle disabled
        CreateDiscussion->>Form: Sync encrypted value with parent status
    end
    CreateDiscussion->>RoomAutoComplete: Display encryption icon if needed
    User->>CreateDiscussion: Submit form
    CreateDiscussion->>API: Create discussion with encrypted + message
    API-->>User: Discussion created successfully
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • PR #36799: Modifies CreateDiscussion component similarly with encryption hint improvements, indicating overlapping feature development in the encrypted discussion workflow.

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • dougfabris
  • yash-rajpal

Poem

🐰 A rabbit hops through encrypted rooms,
Now first messages bloom!
Parent's secret key unlocked the gate,
Discussions secure—hoorah! How great! 🔐✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main fix: preventing non-encrypted discussion creation from encrypted parent rooms.
Linked Issues check ✅ Passed The PR successfully implements the fix for SUP-955 by adding logic to disable encrypted field when parent room is encrypted and passing encrypted status appropriately.
Out of Scope Changes check ✅ Passed All changes directly address the linked issue: adding encrypted parent room detection, disabling encryption toggle appropriately, updating component signatures, and adding test coverage.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/encrypted-discussion

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.

@codecov
Copy link

codecov bot commented Jan 20, 2026

Codecov Report

❌ Patch coverage is 76.47059% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.83%. Comparing base (eb5a1ef) to head (3fd3df5).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #38279      +/-   ##
===========================================
+ Coverage    70.74%   70.83%   +0.09%     
===========================================
  Files         3142     3144       +2     
  Lines       108929   109338     +409     
  Branches     19631    19621      -10     
===========================================
+ Hits         77064    77455     +391     
- Misses       29865    29885      +20     
+ Partials      2000     1998       -2     
Flag Coverage Δ
e2e 60.32% <76.92%> (-0.03%) ⬇️
e2e-api 48.07% <ø> (+0.03%) ⬆️
unit 72.00% <75.90%> (+0.15%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 20, 2026

📦 Docker Image Size Report

➡️ Changes

Service Current Baseline Change Percent
sum of all images 0B 0B 0B
account-service 0B 0B 0B
authorization-service 0B 0B 0B
ddp-streamer-service 0B 0B 0B
omnichannel-transcript-service 0B 0B 0B
presence-service 0B 0B 0B
queue-worker-service 0B 0B 0B
rocketchat 0B 0B 0B

📊 Historical Trend

---
config:
  theme: "dark"
  xyChart:
    width: 900
    height: 400
---
xychart
  title "Image Size Evolution by Service (Last 30 Days + This PR)"
  x-axis ["11/18 22:53", "11/19 23:02", "11/21 16:49", "11/24 17:34", "11/27 22:32", "11/28 19:05", "12/01 23:01", "12/02 21:57", "12/03 21:00", "12/04 18:17", "12/05 21:56", "12/08 20:15", "12/09 22:17", "12/10 23:26", "12/11 21:56", "12/12 22:45", "12/13 01:34", "12/15 22:31", "12/16 22:18", "12/17 21:04", "12/18 23:12", "12/19 23:27", "12/20 21:03", "12/22 18:54", "12/23 16:16", "12/24 19:38", "12/25 17:51", "12/26 13:18", "12/29 19:01", "12/30 20:52", "01/21 17:25 (PR)"]
  y-axis "Size (GB)" 0 --> 0.5
  line "account-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "authorization-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "ddp-streamer-service" [0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.12, 0.00]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "presence-service" [0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.11, 0.00]
  line "queue-worker-service" [0.14, 0.14, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.13, 0.00]
  line "rocketchat" [0.35, 0.35, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.34, 0.00]
Loading

Statistics (last 30 days):

  • 📊 Average: 1.5GiB
  • ⬇️ Minimum: 1.4GiB
  • ⬆️ Maximum: 1.6GiB
  • 🎯 Current PR: 0B
ℹ️ About this report

This report compares Docker image sizes from this build against the develop baseline.

  • Tag: pr-38279
  • Baseline: develop
  • Timestamp: 2026-01-21 17:25:33 UTC
  • Historical data points: 30

Updated: Wed, 21 Jan 2026 17:25:33 GMT

@MartinSchoeler MartinSchoeler marked this pull request as ready for review January 21, 2026 17:13
@MartinSchoeler MartinSchoeler requested review from a team as code owners January 21, 2026 17:13
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 8 files

Copy link
Member

@abhinavkrin abhinavkrin left a comment

Choose a reason for hiding this comment

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

The endpoint rooms.createDiscussion does allow creating unencrypted discussions for encrypted rooms. It accepts a field encrypted which if not provided defaults to the parent room encryption status.
So, if the endpoint allows it, IMO, we should not prevent it from being done in the UI.

The encrypted parent room
Image

The unecrypted discussion
Image

@MartinSchoeler
Copy link
Member Author

The endpoint rooms.createDiscussion does allow creating unencrypted discussions for encrypted rooms. It accepts a field encrypted which if not provided defaults to the parent room encryption status. So, if the endpoint allows it, IMO, we should not prevent it from being done in the UI.

The encrypted parent room Image

The unecrypted discussion Image

Currently the UI is always creating an encrypted discussion, just to be sure, lets confirm with product what is the expected behavior, since FE and BE have discordant behaviors

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.

3 participants