-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Department update not working properly on 3.5.0 #18392
Copy link
Copy link
Closed
Description
Description:
There is a bug present on the current master branch (3.5.0) that occur when trying to update the department. I believe it was introduced here: #17049
- What I've noticed is that when trying to make that same Update department API request, here the agents list variable is not passed as argument in the
Livechat.saveDepartment()function, but this function callsupdateDepartmentAgentsfunction and that one requires the agent list variable, making the request always cause an error on Rocket.Chat. - Besides that, there's another missing attribute/parameter here. This
Livechat.saveDepartmentsAgents()function only receives theupsertattribute on the second parameter, but theremoveattribute is marked as mandatory here, making the request always cause an error on Rocket.Chat again.
Steps to reproduce:
- Try to update department agents' data with the Rocket.Chat REST API
Expected behavior:
The request return 200 without any errors.
Actual behavior:
The response is 400, returning an error message from Rocket.Chat (logs below) and the department data is not updated.
Server Setup Information:
- Version of Rocket.Chat Server: 3.5.0
- Operating System: Pop!_OS 20.04 LTS
- Deployment Method:
meteor npm start - Number of Running Instances: 1
- DB Replicaset Oplog: Enabled
- NodeJS Version: 12.16.1 - x64
- MongoDB Version: 4.2.5
Client Setup Information
- Desktop App or Browser Version: Google Chrome Version 84.0.4147.89 (Official Build) (64-bit)
- Operating System: Pop!_OS 20.04 LTS
Additional context
Relevant logs:
- Request response for the first part of the bug:
{
"statusCode": 400,
"content": "{\n \"message\": \"Match error: Expected object, got undefined\",\n \"path\": \"\",\n \"sanitizedError\": {\n \"isClientSafe\": true,\n \"error\": 400,\n \"reason\": \"Match failed\",\n \"message\": \"Match failed [400]\",\n \"errorType\": \"Meteor.Error\"\n },\n \"errorType\": \"Match.Error\",\n \"success\": false\n}",
"headers": {
"x-xss-protection": "1",
"x-content-type-options": "nosniff",
"x-frame-options": "sameorigin",
"x-instance-id": "iCHSy7E7HrpfZxxGZ",
"cache-control": "no-store",
"pragma": "no-cache",
"content-type": "application/json",
"vary": "Accept-Encoding",
"date": "Mon, 27 Jul 2020 15:52:44 GMT",
"connection": "close",
"transfer-encoding": "chunked"
},
"data": {
"message": "Match error: Expected object, got undefined",
"path": "",
"sanitizedError": {
"isClientSafe": true,
"error": 400,
"reason": "Match failed",
"message": "Match failed [400]",
"errorType": "Meteor.Error"
},
"errorType": "Match.Error",
"success": false
}
}
- Request response for the second part of the bug:
{
"statusCode": 400,
"content": "{\n \"message\": \"Match error: Missing key 'remove'\",\n \"path\": \"\",\n \"sanitizedError\": {\n \"isClientSafe\": true,\n \"error\": 400,\n \"reason\": \"Match failed\",\n \"message\": \"Match failed [400]\",\n \"errorType\": \"Meteor.Error\"\n },\n \"errorType\": \"Match.Error\",\n \"success\": false\n}",
"headers": {
"x-xss-protection": "1",
"x-content-type-options": "nosniff",
"x-frame-options": "sameorigin",
"x-instance-id": "q3jggGfwWkjWqmKkA",
"cache-control": "no-store",
"pragma": "no-cache",
"content-type": "application/json",
"vary": "Accept-Encoding",
"date": "Mon, 27 Jul 2020 15:54:10 GMT",
"connection": "close",
"transfer-encoding": "chunked"
},
"data": {
"message": "Match error: Missing key 'remove'",
"path": "",
"sanitizedError": {
"isClientSafe": true,
"error": 400,
"reason": "Match failed",
"message": "Match failed [400]",
"errorType": "Meteor.Error"
},
"errorType": "Match.Error",
"success": false
}
}
Reactions are currently unavailable