Skip to content

Conversation

@pierre-lehnen-rc
Copy link
Contributor

@pierre-lehnen-rc pierre-lehnen-rc commented Dec 18, 2025

Proposed changes (including videos or screenshots)

Issue(s)

VGA-116

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features

    • Call history now stores and shows contact display names and usernames for clearer identification.
  • Improvements

    • Call history is kept in sync when users change their username or display name—updates propagate to existing call records to preserve consistency.

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

@pierre-lehnen-rc pierre-lehnen-rc added this to the 7.14.0 milestone Dec 18, 2025
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Dec 18, 2025

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 Dec 18, 2025

⚠️ No Changeset found

Latest commit: 122dfe2

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 Dec 18, 2025

Walkthrough

Adds contact name and username to internal call-history records, saves those fields when creating internal call history entries, and updates call-history documents when a user's name or username changes via a new CallHistory.updateUserReferences method wired into the user-save flow.

Changes

Cohort / File(s) Summary
Model typings & types
packages/core-typings/src/ICallHistoryItem.ts, packages/model-typings/src/models/ICallHistoryModel.ts
Added optional contactName? and contactUsername? to IInternalMediaCallHistoryItem; added updateUserReferences(userId, username, name?) to ICallHistoryModel.
CallHistory model implementation
packages/models/src/models/CallHistory.ts
Implemented CallHistoryRaw.updateUserReferences(userId, username, name?) to bulk-update call-history docs by contactId, setting contactUsername and contactName when provided.
Server user-save flow
apps/meteor/app/lib/server/functions/saveUserIdentity.ts
Imported CallHistory and invoked CallHistory.updateUserReferences alongside existing update calls when username/name change is detected.
Media call service
apps/meteor/server/services/media-call/service.ts
Added private getContactDataForInternalHistory(contact) and refactored saveInternalCallToHistory to include contactId, contactName, and contactUsername via the helper for inbound/outbound items.
Unit tests
apps/meteor/tests/unit/server/users/saveUserIdentity.spec.ts
Mocked/stubbed CallHistory.updateUserReferences in tests and updated assertions to expect call-history updates when identity changes occur.
Manifest
package.json
(manifest file listed in diff metadata)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to types across packages (IRegisterUser usage and exported typings).
  • Review CallHistory.updateUserReferences query/filter to ensure it targets contactId correctly and updates only intended fields.
  • Verify media-call helper produces expected shape for existing consumers and persisted documents.
  • Confirm tests correctly mock/proxyquire the new CallHistory hook.

Possibly related PRs

Suggested reviewers

  • tassoevan
  • KevLehman

Poem

🐰 I hopped through logs with a curious nose,
Adding names where the call-history grows.
When usernames change, I nudge each line,
Keeping our records tidy and fine —
A little rabbit’s patch, all neat and close.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR implements name and username fields for call history VGA-116, but does not implement the freeSwitchExtension field requirement from the linked issue. Implement the freeSwitchExtension field for internal calls as specified in VGA-116, or clarify if it's deferred to a separate PR.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title 'chore: save users' names to call history' directly and clearly describes the main change: adding user name information to call history records.
Out of Scope Changes check ✅ Passed All changes are directly scoped to propagating user names and usernames through call history, with 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 chore/user-name-history

📜 Recent 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 ad581c0 and 122dfe2.

📒 Files selected for processing (1)
  • apps/meteor/server/services/media-call/service.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/server/services/media-call/service.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). (3)
  • GitHub Check: 📦 Build Packages
  • GitHub Check: CodeQL-Build
  • GitHub Check: CodeQL-Build

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.

gabriellsh
gabriellsh previously approved these changes Dec 18, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 18, 2025

📦 Docker Image Size Report

📈 Changes

Service Current Baseline Change Percent
sum of all images 1.2GiB 1.2GiB +12MiB
rocketchat 358MiB 347MiB +12MiB
omnichannel-transcript-service 132MiB 132MiB +526B
queue-worker-service 132MiB 132MiB -21B
ddp-streamer-service 126MiB 126MiB -260B
account-service 113MiB 113MiB +289B
authorization-service 111MiB 111MiB +552B
stream-hub-service 110MiB 110MiB +419B
presence-service 110MiB 110MiB +597B

📊 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/15 22:28", "11/16 01:28", "11/17 23:50", "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 13:09", "12/19 13:29 (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]
  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]
  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]
  line "omnichannel-transcript-service" [0.14, 0.14, 0.14, 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]
  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]
  line "queue-worker-service" [0.14, 0.14, 0.14, 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]
  line "rocketchat" [0.36, 0.36, 0.35, 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.35]
  line "stream-hub-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]
Loading

Statistics (last 25 days):

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

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

  • Tag: pr-37867
  • Baseline: develop
  • Timestamp: 2025-12-19 13:29:07 UTC
  • Historical data points: 25

Updated: Fri, 19 Dec 2025 13:29:08 GMT

@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 67.78%. Comparing base (56f1239) to head (122dfe2).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37867      +/-   ##
===========================================
+ Coverage    67.69%   67.78%   +0.08%     
===========================================
  Files         3474     3474              
  Lines       113852   113852              
  Branches     20938    20938              
===========================================
+ Hits         77073    77172      +99     
+ Misses       34595    34494     -101     
- Partials      2184     2186       +2     
Flag Coverage Δ
e2e 57.19% <ø> (+0.02%) ⬆️
e2e-api 44.96% <0.00%> (+0.95%) ⬆️

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.

@pierre-lehnen-rc pierre-lehnen-rc marked this pull request as ready for review December 18, 2025 22:03
@pierre-lehnen-rc pierre-lehnen-rc requested review from a team as code owners December 18, 2025 22:03
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 (1)
packages/models/src/models/CallHistory.ts (1)

32-48: Consider adding a database index on contactId for performance.

The implementation correctly updates call history records when user identity changes. However, the updateMany query filters by contactId, which is not currently indexed (only uid and callId are indexed per line 13).

For users with extensive call history, this could result in slower updates. While this is a one-time operation per user identity change, consider adding an index on contactId if performance becomes a concern.

📜 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 3b9aab8 and ad581c0.

📒 Files selected for processing (6)
  • apps/meteor/app/lib/server/functions/saveUserIdentity.ts (2 hunks)
  • apps/meteor/server/services/media-call/service.ts (2 hunks)
  • apps/meteor/tests/unit/server/users/saveUserIdentity.spec.ts (5 hunks)
  • packages/core-typings/src/ICallHistoryItem.ts (1 hunks)
  • packages/model-typings/src/models/ICallHistoryModel.ts (2 hunks)
  • packages/models/src/models/CallHistory.ts (2 hunks)
🧰 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:

  • packages/models/src/models/CallHistory.ts
  • apps/meteor/server/services/media-call/service.ts
  • apps/meteor/app/lib/server/functions/saveUserIdentity.ts
  • packages/model-typings/src/models/ICallHistoryModel.ts
  • packages/core-typings/src/ICallHistoryItem.ts
  • apps/meteor/tests/unit/server/users/saveUserIdentity.spec.ts
**/*.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.ts extension for test files (e.g., login.spec.ts)

Files:

  • apps/meteor/tests/unit/server/users/saveUserIdentity.spec.ts
🧠 Learnings (6)
📓 Common learnings
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: apps/meteor/server/services/media-call/service.ts:141-141
Timestamp: 2025-11-19T18:20:37.116Z
Learning: In apps/meteor/server/services/media-call/service.ts, the sendHistoryMessage method should use call.caller.id or call.createdBy?.id as the message author, not call.transferredBy?.id. Even for transferred calls, the message should appear in the DM between the two users who are calling each other, not sent by the person who transferred the call.
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37773
File: apps/meteor/client/views/mediaCallHistory/MediaCallHistoryInternal.tsx:24-34
Timestamp: 2025-12-18T15:18:23.819Z
Learning: In apps/meteor/client/views/mediaCallHistory/MediaCallHistoryInternal.tsx, for internal call history items, the item.contactId is guaranteed to always match either the caller.id or callee.id in the call data, so the contact resolution in getContact will never result in undefined.
📚 Learning: 2025-12-18T15:18:23.819Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37773
File: apps/meteor/client/views/mediaCallHistory/MediaCallHistoryInternal.tsx:24-34
Timestamp: 2025-12-18T15:18:23.819Z
Learning: In apps/meteor/client/views/mediaCallHistory/MediaCallHistoryInternal.tsx, for internal call history items, the item.contactId is guaranteed to always match either the caller.id or callee.id in the call data, so the contact resolution in getContact will never result in undefined.

Applied to files:

  • packages/models/src/models/CallHistory.ts
  • apps/meteor/server/services/media-call/service.ts
  • apps/meteor/app/lib/server/functions/saveUserIdentity.ts
  • packages/model-typings/src/models/ICallHistoryModel.ts
  • packages/core-typings/src/ICallHistoryItem.ts
  • apps/meteor/tests/unit/server/users/saveUserIdentity.spec.ts
📚 Learning: 2025-11-19T18:20:37.116Z
Learnt from: gabriellsh
Repo: RocketChat/Rocket.Chat PR: 37419
File: apps/meteor/server/services/media-call/service.ts:141-141
Timestamp: 2025-11-19T18:20:37.116Z
Learning: In apps/meteor/server/services/media-call/service.ts, the sendHistoryMessage method should use call.caller.id or call.createdBy?.id as the message author, not call.transferredBy?.id. Even for transferred calls, the message should appear in the DM between the two users who are calling each other, not sent by the person who transferred the call.

Applied to files:

  • packages/models/src/models/CallHistory.ts
  • apps/meteor/server/services/media-call/service.ts
  • apps/meteor/app/lib/server/functions/saveUserIdentity.ts
  • packages/model-typings/src/models/ICallHistoryModel.ts
  • packages/core-typings/src/ICallHistoryItem.ts
  • apps/meteor/tests/unit/server/users/saveUserIdentity.spec.ts
📚 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:

  • apps/meteor/app/lib/server/functions/saveUserIdentity.ts
📚 Learning: 2025-10-06T20:30:45.540Z
Learnt from: d-gubert
Repo: RocketChat/Rocket.Chat PR: 37152
File: packages/apps-engine/tests/test-data/storage/storage.ts:101-122
Timestamp: 2025-10-06T20:30:45.540Z
Learning: In `packages/apps-engine/tests/test-data/storage/storage.ts`, the stub methods (updatePartialAndReturnDocument, updateStatus, updateSetting, updateAppInfo, updateMarketplaceInfo) intentionally throw "Method not implemented." Tests using these methods must stub them using `SpyOn` from the test library rather than relying on actual implementations.

Applied to files:

  • apps/meteor/tests/unit/server/users/saveUserIdentity.spec.ts
📚 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 : Ensure tests run reliably in parallel without shared state conflicts

Applied to files:

  • apps/meteor/tests/unit/server/users/saveUserIdentity.spec.ts
🧬 Code graph analysis (5)
packages/models/src/models/CallHistory.ts (1)
packages/core-typings/src/IUser.ts (1)
  • IRegisterUser (261-264)
apps/meteor/server/services/media-call/service.ts (3)
packages/media-signaling/src/lib/Call.ts (1)
  • contact (81-83)
packages/core-typings/src/mediaCalls/IMediaCall.ts (1)
  • IMediaCall (35-68)
packages/core-typings/src/ICallHistoryItem.ts (1)
  • IInternalMediaCallHistoryItem (37-45)
apps/meteor/app/lib/server/functions/saveUserIdentity.ts (1)
packages/models/src/index.ts (1)
  • CallHistory (152-152)
packages/model-typings/src/models/ICallHistoryModel.ts (1)
packages/core-typings/src/IUser.ts (1)
  • IRegisterUser (261-264)
packages/core-typings/src/ICallHistoryItem.ts (1)
packages/core-typings/src/IUser.ts (1)
  • IUser (187-259)
🔇 Additional comments (8)
apps/meteor/app/lib/server/functions/saveUserIdentity.ts (2)

3-3: LGTM!

The CallHistory import follows the established pattern for model imports.


184-186: LGTM!

The CallHistory update propagation correctly mirrors the VideoConference pattern and ensures user identity changes are reflected in call history records.

packages/core-typings/src/ICallHistoryItem.ts (1)

40-41: LGTM!

The optional fields are appropriately typed and positioned. Making them optional ensures backward compatibility with existing call history records.

apps/meteor/server/services/media-call/service.ts (2)

135-143: LGTM!

The helper method appropriately structures contact data for internal call history, making the code more maintainable and ensuring consistent field mapping.


174-174: LGTM!

The spread operator usage cleanly integrates contact data into history items, replacing the previous direct contactId assignments while adding the new identity fields.

Also applies to: 181-181

packages/model-typings/src/models/ICallHistoryModel.ts (1)

1-1: LGTM!

The interface correctly defines the updateUserReferences method contract, with appropriate type references and optional name parameter.

Also applies to: 19-19

apps/meteor/tests/unit/server/users/saveUserIdentity.spec.ts (2)

13-13: LGTM!

The test stub and mock setup correctly mirror the VideoConference pattern, ensuring CallHistory updates are testable.

Also applies to: 36-38


117-117: LGTM!

Test assertions appropriately verify that CallHistory updates occur when user identity changes and are skipped when there are no changes.

Also applies to: 129-129, 139-139

@tassoevan tassoevan added the stat: QA assured Means it has been tested and approved by a company insider label Dec 18, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Dec 18, 2025
@kodiakhq kodiakhq bot merged commit 17496df into develop Dec 19, 2025
49 checks passed
@kodiakhq kodiakhq bot deleted the chore/user-name-history branch December 19, 2025 13:59
gaolin1 pushed a commit to gaolin1/medsense.webchat that referenced this pull request Jan 6, 2026
@dougfabris dougfabris modified the milestones: 7.14.0, 8.0.0 Jan 19, 2026
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.

6 participants