Skip to content

Conversation

@juliajforesti
Copy link
Contributor

@juliajforesti juliajforesti commented Jan 5, 2026

CORE-1196

Proposed changes (including videos or screenshots)

before:
image

after:
image

Issue(s)

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • Bug Fixes
    • Fixed chat transcript rendering when messages contain multiple files.

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

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Jan 5, 2026

Looks like this PR is ready to merge! 🎉
If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Jan 5, 2026

🦋 Changeset detected

Latest commit: 7c234e2

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

This PR includes changesets to release 40 packages
Name Type
@rocket.chat/pdf-worker Patch
@rocket.chat/meteor Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/queue-worker Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@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/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/ui-voip Patch
@rocket.chat/web-ui-registration 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/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core 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

@juliajforesti juliajforesti added this to the 8.1.0 milestone Jan 5, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 5, 2026

Walkthrough

This PR fixes PDF chat transcript formatting when messages contain multiple files. It updates test fixtures to include multiple files per message, adjusts component styling for proper spacing and wrapping, and modifies the Message component's wrap logic to account for file presence.

Changes

Cohort / File(s) Summary
Changeset
.changeset/flat-berries-sell.md
Adds patch-level version bump for @rocket.chat/pdf-worker documenting fix for chat transcript formatting with multiple files per message
Test Fixtures
ee/packages/pdf-worker/src/templates/ChatTranscript/ChatTranscript.fixtures.ts
Expands test data to include 6 file objects in a single message (previously 1), enabling validation of multi-file message scenarios
Component Styling & Layout
ee/packages/pdf-worker/src/templates/ChatTranscript/components/Files.tsx
Introduces container wrapper with 100% width; adjusts spacing (marginBottom on files, marginTop on container); changes image width to 100%; adds fileName style with marginBottom for consistent text spacing
Component Logic
ee/packages/pdf-worker/src/templates/ChatTranscript/components/Message.tsx
Updates wrap prop condition to enable wrapping when message contains files (message.files?.length > 0), in addition to existing quote and text-length conditions

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hops through PDF pages with glee,
Multiple files now flow wild and free!
Margins and wraps align just right,
Chat transcripts formatted, clean and bright,
Every attachment finds its own space—
Fixed formatting brings smiles to each face! 🐰📄

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'fix: broken transcript with multiple files per message' accurately and specifically describes the main change in the changeset.
Linked Issues check ✅ Passed The code changes address CORE-1196 by fixing PDF transcript formatting when messages contain multiple files through updated styling and wrapping logic in Files and Message components.
Out of Scope Changes check ✅ Passed All changes are scoped to PDF transcript rendering for multiple files per message as required by CORE-1196; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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/pdf-worker-multi-files

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.

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 4 files

Copy link
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: 0

🧹 Nitpick comments (2)
ee/packages/pdf-worker/src/templates/ChatTranscript/ChatTranscript.fixtures.ts (1)

157-164: Consider adding variety to the multi-file test fixture.

All six files are identical (same name, same buffer). While this tests the layout for multiple files, adding variety could catch additional edge cases:

  • Different file types (.jpg, .pdf, .txt)
  • Varying file name lengths
  • Mix of valid and invalid buffers
  • Different image dimensions
Example with varied test data
 files: [
   { name: 'screenshot.png', buffer: Buffer.from(base64Image, 'base64') },
-  { name: 'screenshot.png', buffer: Buffer.from(base64Image, 'base64') },
-  { name: 'screenshot.png', buffer: Buffer.from(base64Image, 'base64') },
-  { name: 'screenshot.png', buffer: Buffer.from(base64Image, 'base64') },
-  { name: 'screenshot.png', buffer: Buffer.from(base64Image, 'base64') },
-  { name: 'screenshot.png', buffer: Buffer.from(base64Image, 'base64') },
+  { name: 'document-with-a-very-long-filename.pdf', buffer: Buffer.from(base64Image, 'base64') },
+  { name: 'photo.jpg', buffer: Buffer.from(base64Image, 'base64') },
+  { name: 'img.png', buffer: Buffer.from(base64Image, 'base64') },
+  { name: 'invalid-file.txt', buffer: null },
+  { name: 'another-screenshot.png', buffer: Buffer.from(base64Image, 'base64') },
 ],
ee/packages/pdf-worker/src/templates/ChatTranscript/components/Files.tsx (1)

42-45: Consider a more stable key for file items.

Using array index as the key (line 44) can cause issues if the files array is modified during rendering, though this is less likely in PDF generation contexts. Since file names might not be unique (as seen in the test fixtures), consider using a combination:

-<View style={styles.file} key={index} wrap>
+<View style={styles.file} key={`${file.name}-${index}`} wrap>

This provides better stability while handling potential duplicate file names.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between d3511ea and 3790e42.

📒 Files selected for processing (4)
  • .changeset/flat-berries-sell.md
  • ee/packages/pdf-worker/src/templates/ChatTranscript/ChatTranscript.fixtures.ts
  • ee/packages/pdf-worker/src/templates/ChatTranscript/components/Files.tsx
  • ee/packages/pdf-worker/src/templates/ChatTranscript/components/Message.tsx
🧰 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:

  • ee/packages/pdf-worker/src/templates/ChatTranscript/ChatTranscript.fixtures.ts
  • ee/packages/pdf-worker/src/templates/ChatTranscript/components/Message.tsx
  • ee/packages/pdf-worker/src/templates/ChatTranscript/components/Files.tsx
🧠 Learnings (2)
📚 Learning: 2025-11-24T17:08:17.065Z
Learnt from: CR
Repo: RocketChat/Rocket.Chat PR: 0
File: .cursor/rules/playwright.mdc:0-0
Timestamp: 2025-11-24T17:08:17.065Z
Learning: Applies to apps/meteor/tests/e2e/**/*.spec.ts : Utilize Playwright fixtures (`test`, `page`, `expect`) for consistency in test files

Applied to files:

  • ee/packages/pdf-worker/src/templates/ChatTranscript/ChatTranscript.fixtures.ts
📚 Learning: 2025-12-10T21:00:54.909Z
Learnt from: KevLehman
Repo: RocketChat/Rocket.Chat PR: 37091
File: ee/packages/abac/jest.config.ts:4-7
Timestamp: 2025-12-10T21:00:54.909Z
Learning: Rocket.Chat monorepo: Jest testMatch pattern '<rootDir>/src/**/*.spec.(ts|js|mjs)' is valid in this repo and used across multiple packages (e.g., packages/tools, ee/packages/omnichannel-services). Do not flag it as invalid in future reviews.

Applied to files:

  • ee/packages/pdf-worker/src/templates/ChatTranscript/ChatTranscript.fixtures.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
🔇 Additional comments (4)
.changeset/flat-berries-sell.md (1)

1-5: LGTM! Clear changeset description.

The changeset properly documents this patch-level fix for handling multiple files per message in PDF transcripts.

ee/packages/pdf-worker/src/templates/ChatTranscript/components/Message.tsx (1)

55-55: LGTM! Proper wrapping condition for messages with files.

The addition of (message.files && message.files.length > 0) to the wrap condition correctly enables page breaking when files are present. The defensive check for both existence and length is good practice.

ee/packages/pdf-worker/src/templates/ChatTranscript/components/Files.tsx (2)

10-29: LGTM! Improved responsive layout for file attachments.

The styling updates enhance the layout for multiple files:

  • Container wrapper with proper spacing
  • File items now use marginBottom for consistent spacing
  • Image width set to 100% for responsiveness while preserving aspect ratio
  • Individual file name styling improves visual hierarchy

These changes align well with the PR objective of fixing formatting for multiple files per message.


47-50: The bug workaround comment is justified.

While the coding guidelines prefer avoiding comments, this one documents a workaround for a known react-pdf bug with proper issue reference. This type of explanatory comment for non-obvious behavior is valuable and should remain.

@juliajforesti juliajforesti requested a review from a team January 5, 2026 20:49
@codecov
Copy link

codecov bot commented Jan 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.63%. Comparing base (f6d33a9) to head (7c234e2).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #38064      +/-   ##
===========================================
- Coverage    70.66%   70.63%   -0.03%     
===========================================
  Files         3143     3143              
  Lines       108695   108695              
  Branches     19514    19503      -11     
===========================================
- Hits         76804    76773      -31     
- Misses       29895    29915      +20     
- Partials      1996     2007      +11     
Flag Coverage Δ
e2e 60.16% <ø> (-0.04%) ⬇️
e2e-api 47.41% <ø> (ø)
unit 71.75% <ø> (-0.04%) ⬇️

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 5, 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/07 13:37 (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-38064
  • Baseline: develop
  • Timestamp: 2026-01-07 13:37:33 UTC
  • Historical data points: 30

Updated: Wed, 07 Jan 2026 13:37:34 GMT

Copy link
Member

@dougfabris dougfabris left a comment

Choose a reason for hiding this comment

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

LGTM!

@dougfabris dougfabris added the stat: QA assured Means it has been tested and approved by a company insider label Jan 7, 2026
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Jan 7, 2026
@kodiakhq kodiakhq bot merged commit e639382 into develop Jan 7, 2026
44 checks passed
@kodiakhq kodiakhq bot deleted the fix/pdf-worker-multi-files branch January 7, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: QA assured Means it has been tested and approved by a company insider stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants