Skip to content

Conversation

@lucas-a-pelegrino
Copy link
Contributor

@lucas-a-pelegrino lucas-a-pelegrino commented Oct 3, 2025

Proposed changes (including videos or screenshots)

This PR adds a deprecation warning for livechat:removeTag legacy meteor method, as well as a new endpoint to replace it; livechat/tags.remove

Issue(s)

CORE-1414

Steps to test or reproduce

Further comments

Summary by CodeRabbit

  • New Features
    • Added a REST endpoint to remove Livechat tags (/v1/livechat/tags.delete).
  • Deprecation
    • livechat:removeTag is deprecated; calls now emit a deprecation notice and should use /v1/livechat/tags.delete.
  • Refactor
    • Client and test flows switched to the new REST endpoint and payload for tag removal.
  • Documentation
    • Added deprecation notice documenting the replacement endpoint.
  • Tests
    • Updated E2E helpers to use the new tag removal endpoint.
  • Internationalization
    • Added error message for tag removal failures.
  • Chores
    • Bumped Rocket.Chat packages to patch versions.

@lucas-a-pelegrino lucas-a-pelegrino added this to the 7.12.0 milestone Oct 3, 2025
@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Oct 3, 2025

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

  • This PR is targeting the wrong base branch. It should target 7.12.0, but it targets 7.11.0

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 Oct 3, 2025

🦋 Changeset detected

Latest commit: 8038280

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/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/federation-service 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 Oct 3, 2025

Walkthrough

Adds a POST /v1/livechat/tags.delete REST endpoint with request/response typings and i18n text, migrates client hook and E2E helper to use the new endpoint, logs deprecation for the livechat:removeTag Meteor method, and updates a changeset with package bumps.

Changes

Cohort / File(s) Summary
Client hook migration
apps/meteor/client/omnichannel/tags/useRemoveTag.tsx
Replaces useMethod('livechat:removeTag') with useEndpoint('POST', '/v1/livechat/tags.delete'); sends payload { id: tagId }; preserves success/error/finally flows and query invalidation.
Server REST endpoint & public typings
apps/meteor/ee/app/livechat-enterprise/server/api/tags.ts, packages/rest-typings/src/v1/omnichannel.ts
Adds POST livechat/tags.delete route with auth/permission/enterprise checks; validates body via isPOSTLivechatTagsRemoveParams; calls LivechatEnterprise.removeTag(id); maps responses and exports LivechatTagsEndpoints to extend @rocket.chat/rest-typings.
Method deprecation logging
apps/meteor/ee/app/livechat-enterprise/server/methods/removeTag.ts
Emits methodDeprecationLogger.method('livechat:removeTag', '8.0.0', '/v1/livechat/tags.delete') before existing permission checks; core method behavior unchanged.
E2E test helper update
apps/meteor/tests/e2e/utils/omnichannel/tags.ts
Test helper now calls REST endpoint /livechat/tags.delete with payload { id } instead of invoking the method wrapper JSON payload.
i18n
packages/i18n/src/locales/en.i18n.json
Adds translation key "error-removing-tag": "Error removing tag".
Changeset note
.changeset/shaggy-clocks-allow.md
Documents deprecation of livechat:removeTag, new endpoint /v1/livechat/tags.delete, and patch bumps to @rocket.chat/meteor and @rocket.chat/rest-typings.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant UI as Client UI
  participant Hook as useRemoveTag (client)
  participant API as REST /v1/livechat/tags.delete
  participant SVC as LivechatEnterprise

  rect rgba(200,235,255,0.25)
  note over UI,Hook: New REST removal flow
  UI->>Hook: removeTag(tagId)
  Hook->>API: POST /v1/livechat/tags.delete { id: tagId }
  API->>SVC: LivechatEnterprise.removeTag(id)
  SVC-->>API: success / throws Meteor.Error
  API-->>Hook: success or error response
  Hook-->>UI: show toast / invalidate queries
  end

  rect rgba(255,230,200,0.18)
  note over API: Deprecated method logging (server-side)
  API-->>API: methodDeprecationLogger.method('livechat:removeTag', '8.0.0', '/v1/livechat/tags.delete')
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested reviewers

  • KevLehman
  • dougfabris
  • sampaiodiego

Poem

I nibble code and twitch my nose,
A tag hops off where REST wind blows.
POST the id and send it free,
Old method whispers deprecation to me. 🐇✨

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 clearly states the main objective: adding a deprecation warning for the livechat:removeTag method and providing a new endpoint as its replacement. This accurately reflects the primary changes visible throughout the changeset, including the deprecation log added in the removeTag method, the new REST endpoint implementation, the client-side updates, and supporting typings. The title is specific, concise, and directly communicates the core purpose of the PR without unnecessary noise.
Linked Issues Check ✅ Passed While the linked issue CORE-1414 provides minimal descriptive content, the PR description and the changeset indicate the primary objectives are to add a deprecation warning for the legacy livechat:removeTag method and introduce a new REST endpoint replacement. The implementation successfully addresses these objectives: a deprecation warning is added via methodDeprecationLogger in the old method, a new POST endpoint at /v1/livechat/tags.delete is implemented with proper validation and error handling, the client code is updated to use the new endpoint, and supporting REST typings and error translations are added. All coding-related requirements appear to be fulfilled.
Out of Scope Changes Check ✅ Passed All changes in this PR are directly related to the deprecation of livechat:removeTag and implementation of its replacement endpoint. The modifications include the deprecation warning in the old method, the new REST endpoint and its validation schemas, updates to client code and tests, addition of error message translations, and related package version bumps. Each file change contributes to the core objective without introducing unrelated modifications or feature scope creep.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/v7/CORE-1414

📜 Recent 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 3b70031 and 55b84c2.

📒 Files selected for processing (1)
  • packages/i18n/src/locales/en.i18n.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/i18n/src/locales/en.i18n.json
⏰ 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.

@codecov
Copy link

codecov bot commented Oct 3, 2025

Codecov Report

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

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #37136      +/-   ##
===========================================
+ Coverage    67.11%   67.61%   +0.49%     
===========================================
  Files         3264     3341      +77     
  Lines       112926   114016    +1090     
  Branches     20445    20669     +224     
===========================================
+ Hits         75791    77091    +1300     
+ Misses       34548    34245     -303     
- Partials      2587     2680      +93     
Flag Coverage Δ
e2e 57.33% <100.00%> (+1.80%) ⬆️
unit 71.57% <ø> (-0.05%) ⬇️

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 October 7, 2025 19:07
@lucas-a-pelegrino lucas-a-pelegrino requested review from a team as code owners October 7, 2025 19:07
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 fb0b24c and cb00d6c.

📒 Files selected for processing (7)
  • .changeset/shaggy-clocks-allow.md (1 hunks)
  • apps/meteor/client/omnichannel/tags/useRemoveTag.tsx (1 hunks)
  • apps/meteor/ee/app/livechat-enterprise/server/api/tags.ts (2 hunks)
  • apps/meteor/ee/app/livechat-enterprise/server/methods/removeTag.ts (2 hunks)
  • apps/meteor/tests/e2e/utils/omnichannel/tags.ts (1 hunks)
  • packages/i18n/src/locales/en.i18n.json (2 hunks)
  • packages/rest-typings/src/v1/omnichannel.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,tsx,js,jsx}: Write concise, technical TypeScript/JavaScript with accurate typing
Follow DRY by extracting reusable logic into helper functions or page objects
Avoid code comments in the implementation

Files:

  • apps/meteor/tests/e2e/utils/omnichannel/tags.ts
apps/meteor/tests/e2e/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)

apps/meteor/tests/e2e/**/*.{ts,tsx}: Avoid using page.locator(); prefer semantic locators like page.getByRole, page.getByLabel, page.getByText, and page.getByTitle
Store commonly used locators in variables/constants for reuse
Use page.waitFor() with specific conditions and avoid hardcoded timeouts
Implement proper wait strategies for dynamic content
Follow the Page Object Model pattern consistently

Files:

  • apps/meteor/tests/e2e/utils/omnichannel/tags.ts
🧬 Code graph analysis (1)
apps/meteor/ee/app/livechat-enterprise/server/api/tags.ts (5)
packages/rest-typings/src/v1/omnichannel.ts (2)
  • POSTLivechatTagsRemoveSuccessResponse (544-544)
  • isPOSTLivechatTagsRemoveParams (531-531)
packages/rest-typings/src/v1/Ajv.ts (3)
  • validateBadRequestErrorResponse (46-46)
  • validateUnauthorizedErrorResponse (69-69)
  • validateForbiddenErrorResponse (92-92)
apps/meteor/ee/app/livechat-enterprise/server/lib/LivechatEnterprise.ts (1)
  • LivechatEnterprise (13-183)
apps/meteor/app/api/server/ApiClass.ts (1)
  • ExtractRoutesFromAPI (73-77)
packages/rest-typings/src/index.ts (1)
  • Endpoints (51-98)
🔇 Additional comments (9)
.changeset/shaggy-clocks-allow.md (1)

1-6: LGTM!

The changeset format is correct, and patch bumps are appropriate for deprecation warnings. The description clearly summarizes the change.

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

6-6: LGTM!

The import is correct and necessary for logging the deprecation warning.


18-18: No remaining calls to livechat:removeTag Deprecation warning placement is appropriate and no Meteor.call or DDP client invocations remain.

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

6219-6222: Translation addition looks good

New error string slots in cleanly with the existing messages; no issues spotted.

apps/meteor/client/omnichannel/tags/useRemoveTag.tsx (1)

3-3: LGTM! Clean migration to REST endpoint.

The transition from the deprecated Meteor method to the new REST endpoint is implemented correctly:

  • Import updated to use useEndpoint
  • Endpoint properly configured as POST to /v1/livechat/tags.remove
  • Payload structure updated from tagId to { id: tagId } matching the REST API schema

Also applies to: 11-11, 18-18

apps/meteor/tests/e2e/utils/omnichannel/tags.ts (1)

13-13: LGTM! Test utility updated correctly.

The test helper now correctly calls the new REST endpoint /livechat/tags.remove with the proper payload structure.

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

516-544: LGTM! Validation schemas properly defined.

The validation schemas for the new endpoint are correctly implemented:

  • Request body requires an id string parameter
  • Success response properly typed with { success: true }
  • Follows existing patterns in the codebase

The ajv.compile<void> pattern for the success response validator is consistent with similar endpoints elsewhere in this file (e.g., lines 1451, 1796, 4289).

apps/meteor/ee/app/livechat-enterprise/server/api/tags.ts (2)

1-13: LGTM! Imports properly updated.

All necessary imports are in place for the new endpoint implementation, including validation schemas, type utilities, and the LivechatEnterprise service.


100-105: LGTM! Type augmentation correctly implemented.

The type declarations and module augmentation properly extend the Endpoints interface with the new route, ensuring type safety across the codebase.

@lucas-a-pelegrino lucas-a-pelegrino added the stat: QA assured Means it has been tested and approved by a company insider label Oct 8, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Oct 8, 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

♻️ Duplicate comments (1)
apps/meteor/ee/app/livechat-enterprise/server/api/tags.ts (1)

95-95: i18n key coverage for 'error-removing-tag'

Previous review asked for translations. Please confirm all locales include this key; otherwise clients will show the raw key.

Run:

#!/bin/bash
# List locale files missing the 'error-removing-tag' key
fd -t f -e json packages/i18n/src/locales | while read -r f; do
  if ! rg -q '"error-removing-tag"\s*:' "$f"; then echo "Missing in: $f"; fi
done
🧹 Nitpick comments (2)
apps/meteor/ee/app/livechat-enterprise/server/api/tags.ts (2)

73-79: Optional: return 404 for not found and validate it

Map 404 and surface tag-not-found as Not Found to match GET behavior.

Apply:

@@
-		response: {
+		response: {
+			404: validateNotFoundErrorResponse,
 		},
@@
-			if (error instanceof Meteor.Error) {
-				return API.v1.failure(error.reason);
-			}
+			if (error instanceof Meteor.Error) {
+				if (error.error === 'tag-not-found') {
+					return API.v1.notFound('tag-not-found');
+				}
+				return API.v1.failure(error.error || 'error-removing-tag');
+			}
@@
-import {
+import {
 	isPOSTLivechatTagsRemoveParams,
 	POSTLivechatTagsRemoveSuccessResponse,
 	validateBadRequestErrorResponse,
 	validateForbiddenErrorResponse,
 	validateUnauthorizedErrorResponse,
+	validateNotFoundErrorResponse,
 } from '@rocket.chat/rest-typings';

As LivechatEnterprise.removeTag throws Meteor.Error('tag-not-found', ...). Based on learnings

Also applies to: 91-96, 1-7


1-7: Meteor import for type-safety

Meteor.Error is referenced; if globals aren’t declared in this compilation unit, import Meteor to satisfy types.

Apply:

 } from '@rocket.chat/rest-typings';
 
+import { Meteor } from 'meteor/meteor';
📜 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 cb00d6c and f396da0.

📒 Files selected for processing (4)
  • apps/meteor/client/omnichannel/tags/useRemoveTag.tsx (1 hunks)
  • apps/meteor/ee/app/livechat-enterprise/server/api/tags.ts (2 hunks)
  • apps/meteor/ee/app/livechat-enterprise/server/methods/removeTag.ts (2 hunks)
  • apps/meteor/tests/e2e/utils/omnichannel/tags.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/meteor/client/omnichannel/tags/useRemoveTag.tsx
  • apps/meteor/ee/app/livechat-enterprise/server/methods/removeTag.ts
  • apps/meteor/tests/e2e/utils/omnichannel/tags.ts
🧰 Additional context used
🧬 Code graph analysis (1)
apps/meteor/ee/app/livechat-enterprise/server/api/tags.ts (6)
packages/rest-typings/src/v1/omnichannel.ts (2)
  • POSTLivechatTagsRemoveSuccessResponse (544-544)
  • isPOSTLivechatTagsRemoveParams (531-531)
packages/rest-typings/src/v1/Ajv.ts (3)
  • validateBadRequestErrorResponse (46-46)
  • validateUnauthorizedErrorResponse (69-69)
  • validateForbiddenErrorResponse (92-92)
apps/meteor/ee/app/livechat-enterprise/server/lib/LivechatEnterprise.ts (1)
  • LivechatEnterprise (13-183)
apps/meteor/ee/app/livechat-enterprise/server/methods/removeTag.ts (1)
  • id (17-26)
apps/meteor/app/api/server/ApiClass.ts (1)
  • ExtractRoutesFromAPI (73-77)
packages/rest-typings/src/index.ts (1)
  • Endpoints (51-98)
⏰ 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
🔇 Additional comments (1)
apps/meteor/ee/app/livechat-enterprise/server/api/tags.ts (1)

71-72: Endpoint name vs PR description

Code exposes livechat/tags.delete. PR description mentions livechat/tags.remove. Ensure docs, deprecation message, clients, and tests consistently use .delete (the deprecation logger already points to /v1/livechat/tags.delete).

@kodiakhq kodiakhq bot merged commit 4ab2b7f into develop Oct 17, 2025
49 checks passed
@kodiakhq kodiakhq bot deleted the chore/v7/CORE-1414 branch October 17, 2025 17:23
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.

4 participants