Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/three-insects-roll.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixes a missconception about `/v1/livechat/tags/:tagId` returning 404 if tag is not found
16 changes: 10 additions & 6 deletions apps/meteor/ee/app/livechat-enterprise/server/api/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ API.v1.addRoute(
async get() {
const { tagId } = this.urlParams;

return API.v1.success(
await findTagById({
userId: this.userId,
tagId,
}),
);
const tag = await findTagById({
userId: this.userId,
tagId,
});

if (!tag) {
return API.v1.notFound('Tag not found');
}

return API.v1.success(tag);
},
},
);
3 changes: 1 addition & 2 deletions apps/meteor/tests/end-to-end/api/livechat/13-tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ import { IS_EE } from '../../../e2e/config/constants';
it('should return null when the tag does not exist', async () => {
await updatePermission('manage-livechat-tags', ['admin']);
await updatePermission('view-l-room', ['livechat-agent']);
const response = await request.get(api('livechat/tags/123')).set(credentials).expect('Content-Type', 'application/json').expect(200);
expect(response.body.body).to.be.null;
await request.get(api('livechat/tags/123')).set(credentials).expect('Content-Type', 'application/json').expect(404);
});
it('should return a tag', async () => {
const tag = await saveTags();
Expand Down
Loading