[IMPROVE] Improve performance and remove agents when the department is removed#17049
Merged
sampaiodiego merged 18 commits intodevelopfrom Jul 21, 2020
Merged
[IMPROVE] Improve performance and remove agents when the department is removed#17049sampaiodiego merged 18 commits intodevelopfrom
sampaiodiego merged 18 commits intodevelopfrom
Conversation
Contributor
There was a problem hiding this comment.
@MarcosSpessatto The client-side, for instance, the LivechatDepartmentForm need to stop using the 3rd parameter of the method Livechat.saveDepartment, we need to stop using the departmentAgents parameter here:
var to store it until the user clicks to save. The same can be done when an agent is deleted. Then, you can apply these changes after the user save the department, did you get it?The current implementation is overriding the agents of the departments based on the data passed through that parameter, but to give you an example, the
Livechat Department form fetches the agents through the REST API with pagination. So, when the department is saved, only those agents passed to the parameter will be affected, which means that if the department has 1k agents and the client sent just the data related to the existing agents on the client-side, the other agents in the collection won't be affected, did you get it?And there is one more thing: this code is considering only users passed to the parameter
agents, and this part of the code is considering this also, so any other existing agents in the collection will be removed.To fix this, the client needs to add/remove agents through the REST API methods instead of passing changes related to the agents through the method parameters.
Also, we need to remove this process from this part of the code
Rocket.Chat/app/models/server/models/LivechatDepartment.js
Lines 50 to 56 in f32703f
Contributor
|
@MarcosSpessatto can you please fix the conflicts? |
Contributor
|
@MarcosSpessatto can you please the conflicts? Thanks. |
renatobecker
approved these changes
Jul 21, 2020
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Improved LiveChat department agents query performance and removed agents when the department is removed.