[Bug]: Livechat GET /api/v1/livechat/department?enabled=false ignores filter and returns enabled departments
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- mongodb, node.js, typescript
Direzione di ricerca
Start with apps/meteor/server/api/v1/omnichannel/departments.ts and apps/meteor/server/api/v1/omnichannel/lib/departments.ts, where the issue identifies how the enabled parameter becomes a query filter. Then find or add end-to-end coverage for GET /api/v1/livechat/department?enabled=false. Done means disabled departments are returned, and the response is empty when all departments are enabled.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description:
When querying the Omnichannel departments endpoint with GET /api/v1/livechat/department?enabled=false, the enabled=false query parameter is ignored by the backend query builder. As a result, active/enabled departments are returned instead of only disabled departments.
Steps to reproduce:
- Create a Livechat department in Omnichannel and make sure it is enabled (
enabled: true). - Send an authenticated request:
GET /api/v1/livechat/department?enabled=false - Inspect the returned departments array and count.
Expected behavior:
The endpoint should only return disabled departments (enabled: false). If all departments in the workspace are enabled, it should return an empty array [] (count: 0):
{
"departments": [],
"count": 0,
"offset": 0,
"total": 0,
"success": true
}
Actual behavior:
The enabled=false filter is ignored by the backend query builder. Rocket.Chat returns active departments (enabled: true):
{
"departments": [
{
"_id": "6af442eb499c57876de2b0d4",
"name": "Enabled Dept 1794392811642",
"enabled": true
}
],
"count": 1,
"offset": 0,
"total": 1,
"success": true
}
Server Setup Information:
- Version of Rocket.Chat Server: 8.9.1 (reproduced on latest
develop8.x) - License Type: Community / Enterprise
- Number of Users: 1
- Operating System: Linux / Windows
- Deployment Method: docker
- Number of Running Instances: 1
- DB Replicaset Oplog: Enabled
- NodeJS Version: 24.22.1
- MongoDB Version: 8.0.34
Client Setup Information
- Desktop App or Browser Version: REST API / Chrome
- Operating System: Windows 11
Additional context
Root Cause Analysis:
-
In
apps/meteor/server/api/v1/omnichannel/departments.ts:enabled: enabled === 'true',When
enabledquery parameter is'false', it evaluates tofalse. Whenenabledis omitted (fetching all departments),undefined === 'true'also evaluates tofalse. -
In
apps/meteor/server/api/v1/omnichannel/lib/departments.ts:...(enabled && { enabled: Boolean(enabled) }),Because
enabledis booleanfalse, JavaScript evaluatesfalse && { enabled: ... }tofalse. The{ enabled: false }filter is therefore completely omitted from the MongoDB query, returning all departments regardless of the requested status.
I have already verified this live on a running instance and prepared a PR with the fix and automated end-to-end test coverage.
Relevant logs:
GET /api/v1/livechat/department?enabled=false
Status: 200 OK
Departments returned: 1 (expected 0)
Department: "Enabled Dept 1794392811642" (enabled: true)
- Lingua principale
- TypeScript
- Stelle
- 46.5k
- Fork
- 14.1k
- Merge medio
- 1g 21h
- PR unite (30g)
- 381
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di RocketChat/Rocket.Chat
-
Mark the empty state busy while a new search loads, like the table */}Forse già presa @aditya25bcy10173-a11y l’ha presa 2 giorni fa. Apertatodo type: feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
RocketChat/Rocket.Chat#43699 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Timestamp with a time but no timezone shows as 1 January 1970Forse già presa @Sarthak-agrawal-tech l’ha presa 4 giorni fa. Apertatype: bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
RocketChat/Rocket.Chat#43637 · 6 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Move this mapping from useQuery's old `select` into a usePaginatedQuery `combine`Forse già presa @aditya25bcy10173-a11y l’ha presa 3 giorni fa. Apertatodo type: feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
RocketChat/Rocket.Chat#43609 · 4 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
evaluate switching to the other tab when the selected tab's permission is revoked mid-sessionForse già presa @schizophrenicmaniac l’ha presa 4 giorni fa. Apertatodo type: feature
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
RocketChat/Rocket.Chat#43579 · 3 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Docs say packages can be installed with `npm` but use unsupported `patch:` URLForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertatype: bug
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
RocketChat/Rocket.Chat#43554 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di RocketChat/Rocket.Chat
Issue simili
-
Out of order / duplicate key error shows the key bytes as decimal or UTF-8, not hexForse già presa @bardrop l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 86/100
-
`/leaderboard`, the page and the share image say "be the first" for a program that hasn't startedApertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
codercops/discord-bot#152 ·
I maintainer di solito rispondono entro 1 giorno
-
bug i18n
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
endora-commerce/endora-commerce#1315 ·
I maintainer di solito rispondono entro 1 giorno
-
Two stored artist rows are not act names: "DJS" from a Renate floor heading and "Stevie Cox -"Apertaarea:data-quality importer size:S
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
enorm-labs/event-junkie#5136 ·
I maintainer di solito rispondono entro 1 giorno
-
fix(scripts): set-device-owner.ps1 fails to parse on Windows PowerShell 5.1 (UTF-8 without BOM)Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno