Skip to content

Conversation

@lucas-a-pelegrino
Copy link
Contributor

@lucas-a-pelegrino lucas-a-pelegrino commented Dec 10, 2025

Proposed changes (including videos or screenshots)

This PR adds deprecation warning for livechat:removeBusinessHour and new endpoint to replace it; livechat/business-hours.remove

Issue(s)

CORE-1413

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features
    • New REST API endpoint for removing livechat business hours with enhanced request validation and structured error responses.
    • Updated client integration to use the new REST endpoint instead of the legacy method-based approach for improved consistency.

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

lucas-a-pelegrino and others added 19 commits December 3, 2025 17:08
…e/CORE-1413

# Conflicts:
#	apps/meteor/app/livechat/imports/server/rest/businessHours.ts
#	packages/rest-typings/src/v1/omnichannel.ts
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Dec 10, 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 10, 2025

🦋 Changeset detected

Latest commit: f276a21

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

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/rest-typings Patch
@rocket.chat/api-client Patch
@rocket.chat/core-services Patch
@rocket.chat/ddp-client Patch
@rocket.chat/http-router Patch
@rocket.chat/models Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/livechat Patch
@rocket.chat/mock-providers Patch
@rocket.chat/cron Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/media-calls Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/core-typings Patch
@rocket.chat/apps Patch
@rocket.chat/freeswitch Patch
@rocket.chat/model-typings Patch
@rocket.chat/license Patch
@rocket.chat/pdf-worker 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
Contributor

coderabbitai bot commented Dec 10, 2025

Walkthrough

This pull request introduces a new REST API endpoint (livechat/business-hours.remove) to replace the deprecated method-based approach (livechat:removeBusinessHour). Changes include server-side endpoint implementation with validation, client hook refactoring, deprecation logging, type definitions, and test updates to use the new endpoint.

Changes

Cohort / File(s) Summary
Deprecation & Changelog
.changeset/weak-frogs-relax.md
Documents deprecation of livechat:removeBusinessHour method in favor of new livechat/business-hours.remove endpoint; notes dependency patch versions.
REST API Implementation
apps/meteor/app/livechat/imports/server/rest/businessHours.ts
Adds new POST endpoint livechat/business-hours.remove with body validation using isPOSTLivechatBusinessHoursRemoveParams, response schema, and authorization; extracts _id and type from request body and calls removeBusinessHourByIdAndType service method.
Client Hook Refactoring
apps/meteor/client/views/omnichannel/businessHours/useRemoveBusinessHour.tsx
Updates hook to use useEndpoint instead of useMethod; changes call from positional arguments to structured object payload { _id, type } for POST /v1/livechat/business-hours.remove.
Deprecation Logging
apps/meteor/ee/app/livechat-enterprise/server/methods/removeBusinessHour.ts
Adds deprecation log warning to livechat:removeBusinessHour method indicating migration to new REST endpoint.
Test Updates
apps/meteor/tests/data/livechat/businessHours.ts
Replaces method-based test call with REST endpoint POST to livechat/business-hours.remove using simplified payload structure.
Type Definitions
packages/rest-typings/src/v1/omnichannel.ts
Introduces POSTLivechatBusinessHoursRemoveParams type with _id and type fields; adds POSTLivechatBusinessHoursRemoveParamsSchema and POSTLivechatBusinessHoursRemoveSuccessSchema validators; exports corresponding response type.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • REST endpoint implementation (businessHours.ts): Verify route registration, parameter validation wiring, response schema correctness, and integration with existing route definitions
  • Type definition schemas (omnichannel.ts): Confirm validators enforce required fields, type constraints, and align with endpoint implementation
  • Cross-system consistency: Ensure client refactoring, server implementation, and type definitions are properly coordinated for the endpoint contract

Suggested labels

stat: ready to merge, stat: QA assured

Suggested reviewers

  • dougfabris
  • pierre-lehnen-rc
  • KevLehman

Poem

🐰 A method fades to REST so clean,
Business hours removed—no in-between!
Types align with endpoints bright,
Deprecation logs shine oh-so-right.

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 title accurately describes the main changes: adding a deprecation warning for livechat:removeBusinessHour and introducing a new endpoint to replace it.
Linked Issues check ✅ Passed The pull request implements the core objective of deprecating livechat:removeBusinessHour and providing a new REST endpoint livechat/business-hours.remove as replacement.
Out of Scope Changes check ✅ Passed All changes are scoped to the deprecation objective: changelog entry, deprecation logging, new REST endpoint implementation, client-side migration, and test updates.
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/CORE-1413

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.

@lucas-a-pelegrino lucas-a-pelegrino added this to the 7.14.0 milestone Dec 10, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

📦 Docker Image Size Report

📈 Changes

Service Current Baseline Change Percent
sum of all images 1.2GiB 1.2GiB +9.7MiB
rocketchat 358MiB 349MiB +9.7MiB
omnichannel-transcript-service 132MiB 132MiB -755B
queue-worker-service 132MiB 132MiB +1.3KiB
ddp-streamer-service 126MiB 126MiB -948B
account-service 113MiB 113MiB -244B
stream-hub-service 111MiB 111MiB -257B
presence-service 111MiB 111MiB +33B
authorization-service 111MiB 111MiB -192B

📊 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 17:41", "12/11 19:31 (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]
  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]
  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]
  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]
  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]
  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]
  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.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]
Loading

Statistics (last 18 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-37775
  • Baseline: develop
  • Timestamp: 2025-12-11 19:31:51 UTC
  • Historical data points: 18

Updated: Thu, 11 Dec 2025 19:31:51 GMT

@codecov
Copy link

codecov bot commented Dec 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.71%. Comparing base (ddf6717) to head (6ece6b9).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop   #37775   +/-   ##
========================================
  Coverage    67.70%   67.71%           
========================================
  Files         3452     3452           
  Lines       113975   113975           
  Branches     20940    20940           
========================================
+ Hits         77168    77173    +5     
- Misses       34678    34679    +1     
+ Partials      2129     2123    -6     
Flag Coverage Δ
e2e 57.27% <100.00%> (+0.01%) ⬆️
e2e-api 42.33% <ø> (ø)

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.

@lucas-a-pelegrino lucas-a-pelegrino marked this pull request as ready for review December 11, 2025 00:41
@lucas-a-pelegrino lucas-a-pelegrino requested a review from a team as a code owner December 11, 2025 00:41
@lucas-a-pelegrino lucas-a-pelegrino requested review from a team as code owners December 11, 2025 00:41
@lucas-a-pelegrino lucas-a-pelegrino added the stat: QA assured Means it has been tested and approved by a company insider label Dec 11, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Dec 11, 2025
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: 1

📜 Review details

Configuration used: CodeRabbit 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 872da49 and 6ece6b9.

📒 Files selected for processing (6)
  • .changeset/weak-frogs-relax.md (1 hunks)
  • apps/meteor/app/livechat/imports/server/rest/businessHours.ts (2 hunks)
  • apps/meteor/client/views/omnichannel/businessHours/useRemoveBusinessHour.tsx (1 hunks)
  • apps/meteor/ee/app/livechat-enterprise/server/methods/removeBusinessHour.ts (2 hunks)
  • apps/meteor/tests/data/livechat/businessHours.ts (2 hunks)
  • packages/rest-typings/src/v1/omnichannel.ts (1 hunks)
🧰 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/ee/app/livechat-enterprise/server/methods/removeBusinessHour.ts
  • apps/meteor/tests/data/livechat/businessHours.ts
  • packages/rest-typings/src/v1/omnichannel.ts
  • apps/meteor/client/views/omnichannel/businessHours/useRemoveBusinessHour.tsx
  • apps/meteor/app/livechat/imports/server/rest/businessHours.ts
🧠 Learnings (2)
📚 Learning: 2025-11-04T16:49:19.107Z
Learnt from: ricardogarim
Repo: RocketChat/Rocket.Chat PR: 37377
File: apps/meteor/ee/server/hooks/federation/index.ts:86-88
Timestamp: 2025-11-04T16:49:19.107Z
Learning: In Rocket.Chat's federation system (apps/meteor/ee/server/hooks/federation/), permission checks follow two distinct patterns: (1) User-initiated federation actions (creating rooms, adding users to federated rooms, joining from invites) should throw MeteorError to inform users they lack 'access-federation' permission. (2) Remote server-initiated federation events should silently skip/ignore when users lack permission. The beforeAddUserToRoom hook only executes for local user-initiated actions, so throwing an error there is correct. Remote federation events are handled separately by the federation Matrix package with silent skipping logic.

Applied to files:

  • apps/meteor/ee/app/livechat-enterprise/server/methods/removeBusinessHour.ts
📚 Learning: 2025-09-19T15:15:04.642Z
Learnt from: rodrigok
Repo: RocketChat/Rocket.Chat PR: 36991
File: apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Settings.ts:219-221
Timestamp: 2025-09-19T15:15:04.642Z
Learning: The Federation_Matrix_homeserver_domain setting in apps/meteor/server/services/federation/infrastructure/rocket-chat/adapters/Settings.ts is part of the old federation system and is being deprecated/removed, so configuration issues with this setting should not be flagged for improvement.

Applied to files:

  • apps/meteor/ee/app/livechat-enterprise/server/methods/removeBusinessHour.ts
  • .changeset/weak-frogs-relax.md
🧬 Code graph analysis (3)
apps/meteor/tests/data/livechat/businessHours.ts (1)
apps/meteor/tests/data/api-data.ts (2)
  • request (10-10)
  • credentials (39-42)
apps/meteor/client/views/omnichannel/businessHours/useRemoveBusinessHour.tsx (2)
packages/ui-contexts/src/index.ts (3)
  • useTranslation (81-81)
  • useSetModal (71-71)
  • useToastMessageDispatch (78-78)
packages/mock-providers/src/MockedAppRootBuilder.tsx (1)
  • queryClient (270-280)
apps/meteor/app/livechat/imports/server/rest/businessHours.ts (1)
packages/rest-typings/src/v1/omnichannel.ts (4)
  • POSTLivechatBusinessHoursSaveSuccessResponse (3412-3412)
  • isPOSTLivechatBusinessHoursSaveParams (3396-3398)
  • POSTLivechatBusinessHoursRemoveSuccessResponse (3449-3449)
  • isPOSTLivechatBusinessHoursRemoveParams (3433-3435)
🔇 Additional comments (13)
.changeset/weak-frogs-relax.md (1)

1-6: LGTM!

The changeset accurately documents the deprecation of the old method and the introduction of the new REST endpoint. The patch version bump is appropriate for this type of backward-compatible change.

apps/meteor/ee/app/livechat-enterprise/server/methods/removeBusinessHour.ts (2)

5-5: LGTM!

The deprecation logger import is correctly added to support the deprecation warning.


16-17: LGTM!

The deprecation warning is correctly placed at the beginning of the method execution, before any business logic. This ensures all callers of the deprecated method receive the warning. The version target (8.0.0) and replacement endpoint path are clearly specified.

apps/meteor/tests/data/livechat/businessHours.ts (2)

6-6: LGTM!

The methodCall import is correctly removed as it's no longer needed after migrating to the REST endpoint.


134-140: LGTM!

The test helper correctly migrates from the deprecated methodCall approach to the new REST endpoint. The payload structure { _id, type } matches the POSTLivechatBusinessHoursRemoveParams schema defined in rest-typings.

apps/meteor/client/views/omnichannel/businessHours/useRemoveBusinessHour.tsx (3)

3-3: LGTM!

The import is correctly updated from useMethod to useEndpoint to support the new REST-based approach.


11-11: LGTM!

The hook correctly uses useEndpoint with the POST method and the new endpoint path. This aligns with the server-side route definition.


17-17: LGTM!

The call signature is correctly updated from positional arguments (_id, type) to an object payload ({ _id, type }), matching the REST endpoint's expected body schema.

packages/rest-typings/src/v1/omnichannel.ts (2)

3414-3435: LGTM!

The type definition and JSON schema for POSTLivechatBusinessHoursRemoveParams are well-structured and follow the existing patterns in the codebase. Both required fields (_id and type) are correctly specified with additionalProperties: false for strict validation.


3437-3449: LGTM!

The success response schema follows the established pattern used by other endpoints in this file (e.g., POSTLivechatBusinessHoursSaveSuccessSchema). The required: ['success'] constraint ensures the response is properly validated.

apps/meteor/app/livechat/imports/server/rest/businessHours.ts (3)

5-6: LGTM!

The imports for the new validation schema and success response type are correctly added.


31-50: LGTM!

The save endpoint is correctly refactored to use the method chaining pattern with explicit response schemas, authentication requirement, and body validation. The existing functionality is preserved.


72-77: LGTM!

The type extraction and module augmentation correctly extend the Endpoints interface with the new routes, ensuring type safety for clients using these endpoints.

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.

Frontend looks good to me!

@ggazzo ggazzo merged commit 5b3f93c into develop Dec 11, 2025
11 checks passed
@ggazzo ggazzo deleted the chore/CORE-1413 branch December 11, 2025 20:00
ricardogarim pushed a commit that referenced this pull request Dec 15, 2025
@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