[FIX] LiveChat switch department not working#11011
Conversation
…he data was not being updated in the visitor collection.
ggazzo
left a comment
There was a problem hiding this comment.
@renatobecker the code looks good but I found a weird behavior:
at the first change, we can se the both options... and the popout doesnt close after the change...
and just a thought but if you already started a chat and changed the department I dont think we should wait for another message to call for a new attendant
|
Related to your first question, that behaviour has been fixed here:https://github.com/RocketChat/Rocket.Chat/pull/10695/files#diff-e531651dd1b362372762eb86f21419f0R76 About the second question, I changed the method called in the Livechat widget. I saw that when an agent was calling the switch department on their side, the behaviour of the process was different from when it was called by Livechat's side, but I do not know the reason for that, so I unified the method called in both sides. Now, when a visitor tries to switch departments, an agent is automatically assigned to the chat (by using I'll be waiting for your review. |
…:RocketChat/Rocket.Chat into fix-changing-livechat-visitor-department
# Conflicts: # packages/rocketchat-livechat/.app/client/views/livechatWindow.js # packages/rocketchat-livechat/.app/client/views/switchDepartment.js
ggazzo
left a comment
There was a problem hiding this comment.
@renatobecker sorry for the delay...
(I changed the promise alert) and I made more tests, the department changed, but the agent on header not..

just changed after a refresh page
| if (!result.value) { | ||
| return; | ||
| } | ||
| }, () => { |
There was a problem hiding this comment.
I think we updated the sweetalert and now its promise based, we should change to
}).then(() => {|
@ggazzo, I just fixed this PR. But now everything is OK! Thanks. |
# Conflicts: # packages/rocketchat-livechat/.app/client/views/switchDepartment.js # packages/rocketchat-livechat/.app/package-lock.json # packages/rocketchat-livechat/server/methods/getInitialData.js # packages/rocketchat-livechat/server/methods/setDepartmentForVisitor.js

Closes #7397
When a livechat visitor attempted to change the current department, they were staying in the same department.
This was happening because the new department data was not being updated in the visitor collection.