Skip to content

Conversation

@KevLehman
Copy link
Member

@KevLehman KevLehman commented Apr 14, 2025

Proposed changes (including videos or screenshots)

Issue(s)

https://rocketchat.atlassian.net/browse/CTZ-47

Steps to test or reproduce

Further comments


This pull request focuses on addressing various TODOs and refactoring efforts within the Omnichannel component of the Rocket.Chat project. Key changes include:

  1. Refactoring and Optimization:

    • Refactored the GET and DELETE endpoints for livechat users to streamline user fetching and removal processes.
    • Updated visitor deletion logic to include a token parameter.
    • Improved QueueManager class for better department online status checking and model imports.
    • Enhanced livechat department management with new helper functions and centralized logic into hooks.
    • Improved livechat guest management functions for cleaner data updates and optimized database queries.
    • Refactored hooks to handle department status changes and notify listeners.
    • Simplified offline email sending logic and guest alias addition in messages.
    • Updated livechat user management functions for consistency and improved typing.
  2. Interface and Model Enhancements:

    • Added new method signatures to the ILivechatDepartmentModel and ILivechatRoomsModel interfaces for enhanced flexibility and type safety.
    • Introduced a new method to the ILivechatVisitorsModel interface for updating visitor departments.
    • Refined the IUsersModel interface by removing deprecated methods and adding new role-related functionality.
  3. Performance Improvements:

    • Replaced sequential await calls with Promise.all for concurrent execution in department fallback logic.
    • Modified room retrieval logic in the sendTranscript function for potential performance gains.
  4. Code Organization and Maintainability:

    • Introduced changes to improve code organization, maintainability, and type safety across various components.
    • Identified potential issues in visitor validation and user ID usage in specific functions.

Overall, this pull request aims to enhance the functionality, performance, and maintainability of the Omnichannel component by addressing existing TODOs and implementing significant refactoring efforts.


This pull request focuses on addressing various TODOs and refactoring tasks within the Omnichannel component of the Rocket.Chat project. Key changes include:

  1. API and Logic Enhancements:

    • Refactored the API route handling for livechat users to improve logic for fetching and deleting users by type.
    • Modified visitor deletion logic to include the token parameter, enhancing the robustness of the process.
  2. Code Refactoring and Optimization:

    • Improved import statements in QueueManager.ts and refactored department management functions for better maintainability and performance.
    • Enhanced type safety and refactored functions in guests.ts, messages.ts, and sendTranscript.ts for improved readability and efficiency.
    • Updated error handling and user role management in omni-users.ts.
  3. Concurrency and Efficiency Improvements:

    • Utilized Promise.all for concurrent operations in beforeRoutingChat.ts and guests.ts, optimizing asynchronous processes.
  4. Model and Interface Updates:

    • Added new methods to various models, including ILivechatDepartmentModel, ILivechatRoomsModel, ILivechatVisitorsModel, and IUsersModel, to enhance query capabilities and refine role-based queries.
    • Removed redundant methods and improved type safety in model interfaces.
  5. Miscellaneous:

    • Added a TODO comment for future AJV validation implementation in the department agents route.

These changes aim to improve code maintainability, performance, and functionality within the Omnichannel component.


This pull request, titled "chore: Fix some TODOs from Omnichannel - 1," targets the develop branch from the chore/todo branch in the RocketChat/Rocket.Chat repository. The changes focus on refactoring and improving various aspects of the Omnichannel feature set.

Key updates include:

  1. API and Logic Enhancements:

    • Refactored the API route for livechat users to enhance the logic for fetching and deleting users by type.
    • Updated visitor deletion logic to include the token parameter, improving robustness.
    • Simplified department assignment logic for guests by removing redundant database calls.
  2. Code Refactoring and Optimization:

    • Refactored several livechat server library functions for better readability, performance, and type safety.
    • Improved error handling by replacing 'Meteor.Error' with 'Error' and updated user role management.
    • Modified import statements and refactored functions to streamline processes and improve efficiency.
  3. Interface and Model Updates:

    • Added new methods to interfaces and models to enhance department and user query capabilities.
    • Introduced options parameters to certain methods for improved flexibility and type safety.
    • Removed unused methods and refined user role management functionality.
  4. Miscellaneous Improvements:

    • Introduced new functions for handling live chat department archiving and unarchiving.
    • Refactored the sendOfflineMessage function to use the Mailer.send method directly.
    • Added TODO comments for future improvements, such as using AJV validation in permissionsRequired sections.

These changes collectively aim to enhance the functionality, efficiency, and maintainability of the Omnichannel features within the Rocket.Chat application.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Apr 14, 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.7.0, but it targets 7.6.0

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@github-actions
Copy link
Contributor

github-actions bot commented Apr 14, 2025

PR Preview Action v1.6.1

🚀 View preview at
https://RocketChat.github.io/Rocket.Chat/pr-preview/pr-35799/

Built to branch gh-pages at 2025-04-23 20:51 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@changeset-bot
Copy link

changeset-bot bot commented Apr 14, 2025

⚠️ No Changeset found

Latest commit: bfe5f82

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

@codecov
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 61.19%. Comparing base (6429534) to head (bfe5f82).
Report is 1 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #35799      +/-   ##
===========================================
+ Coverage    61.17%   61.19%   +0.01%     
===========================================
  Files         3005     3153     +148     
  Lines        71387    74358    +2971     
  Branches     16342    16610     +268     
===========================================
+ Hits         43670    45500    +1830     
- Misses       24748    25808    +1060     
- Partials      2969     3050      +81     
Flag Coverage Δ
e2e 57.87% <ø> (-0.01%) ⬇️
unit 75.00% <100.00%> (-0.01%) ⬇️

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.

@kody-ai
Copy link

kody-ai bot commented Apr 14, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@kody-ai
Copy link

kody-ai bot commented Apr 14, 2025

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@kody-ai
Copy link

kody-ai bot commented Apr 14, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

1 similar comment
@kody-ai
Copy link

kody-ai bot commented Apr 14, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@KevLehman KevLehman marked this pull request as ready for review April 14, 2025 20:15
@KevLehman KevLehman requested review from a team as code owners April 14, 2025 20:15
@kody-ai
Copy link

kody-ai bot commented Apr 14, 2025

Kody Review Complete

Great news! 🎉
No issues were found that match your current review configurations.

Keep up the excellent work! 🚀

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the @kody start-review command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Security
Code Style
Kody Rules
Refactoring
Error Handling
Maintainability
Potential Issues
Documentation And Comments
Performance And Optimization
Breaking Changes

Access your configuration settings here.

@KevLehman KevLehman added this to the 7.7.0 milestone Apr 22, 2025
@KevLehman KevLehman changed the title chore: Fix some TODOs from Omnichannel - 1 chore: Remove Omnichannel tech debt - 1 Apr 23, 2025
@KevLehman KevLehman requested a review from sampaiodiego April 23, 2025 20:28
@sampaiodiego sampaiodiego added the stat: QA assured Means it has been tested and approved by a company insider label Apr 23, 2025
@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label Apr 23, 2025
@kodiakhq kodiakhq bot merged commit 72dfcf8 into develop Apr 23, 2025
48 checks passed
@kodiakhq kodiakhq bot deleted the chore/todo branch April 23, 2025 22:03
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