From 12122637ccb3f30835375943e817e81f9cb53129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 1 Mar 2026 13:56:04 -0500 Subject: [PATCH 1/4] test: fix spec --- public/openapi/write/categories/cid/watch.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/openapi/write/categories/cid/watch.yaml b/public/openapi/write/categories/cid/watch.yaml index 8ed5a10d1e..c46ceaaa2e 100644 --- a/public/openapi/write/categories/cid/watch.yaml +++ b/public/openapi/write/categories/cid/watch.yaml @@ -55,7 +55,7 @@ put: type: array description: A list of cids that have had their watch states modified. items: - type: number + type: string delete: tags: - categories @@ -99,4 +99,4 @@ delete: type: array description: A list of cids that have had their watch states modified. items: - type: number \ No newline at end of file + type: string \ No newline at end of file From 04477f07db66bc8c841604aed37dddb9f47b5402 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 1 Mar 2026 14:11:48 -0500 Subject: [PATCH 2/4] fix: parent cid --- src/categories/index.js | 14 +++++++------- test/search.js | 5 +++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/categories/index.js b/src/categories/index.js index 4d772f49f9..df66600794 100644 --- a/src/categories/index.js +++ b/src/categories/index.js @@ -330,7 +330,7 @@ Categories.flattenCategories = function (allCategories, categoryData) { * @param parentCid {number} start from 0 to build full tree */ Categories.getTree = function (categories, parentCid) { - parentCid = parentCid || 0; + parentCid = String(parentCid || 0); const cids = categories.map(category => category && category.cid); const cidToCategory = {}; const parents = {}; @@ -351,15 +351,15 @@ Categories.getTree = function (categories, parentCid) { return; } if (!category.hasOwnProperty('parentCid') || category.parentCid === null) { - category.parentCid = 0; + category.parentCid = '0'; } - if (category.parentCid === parentCid) { + if (String(category.parentCid) === parentCid) { tree.push(category); category.parent = parents[parentCid]; } else { - const parent = cidToCategory[category.parentCid]; + const parent = cidToCategory[String(category.parentCid)]; if (parent && parent.cid !== category.cid) { - category.parent = parents[category.parentCid]; + category.parent = parents[String(category.parentCid)]; parent.children = parent.children || []; parent.children.push(category); } @@ -413,10 +413,10 @@ Categories.buildForSelectCategories = function (categories, fields, parentCid) { category.children.forEach(child => recursive(child, categoriesData, `    ${level}`, depth + 1)); } } - parentCid = parentCid || 0; + parentCid = String(parentCid || 0); const categoriesData = []; - const rootCategories = categories.filter(category => category && category.parentCid === parentCid); + const rootCategories = categories.filter(category => category && String(category.parentCid) === parentCid); rootCategories.sort((a, b) => { if (a.order !== b.order) { diff --git a/test/search.js b/test/search.js index f0e285cb9d..e0b1421786 100644 --- a/test/search.js +++ b/test/search.js @@ -130,9 +130,10 @@ describe('Search', () => { it('should search for categories', async () => { const socketCategories = require('../src/socket.io/categories'); - let data = await socketCategories.categorySearch({ uid: phoebeUid }, { query: 'baz', parentCid: 0 }); + let data = await socketCategories.categorySearch({ uid: phoebeUid }, { search: 'baz', parentCid: 0 }); + assert.strictEqual(data.length, 1); assert.strictEqual(data[0].name, 'baz category'); - data = await socketCategories.categorySearch({ uid: phoebeUid }, { query: '', parentCid: 0 }); + data = await socketCategories.categorySearch({ uid: phoebeUid }, { search: '', parentCid: 0 }); assert.strictEqual(data.length, 5); }); From 08e94e35d7648d3ab5cf767072a0ab71de5f45b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 1 Mar 2026 14:14:42 -0500 Subject: [PATCH 3/4] lint: remove unused --- src/api/categories.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/api/categories.js b/src/api/categories.js index 61071a9598..d0dd8d47df 100644 --- a/src/api/categories.js +++ b/src/api/categories.js @@ -8,7 +8,6 @@ const user = require('../user'); const groups = require('../groups'); const privileges = require('../privileges'); const activitypub = require('../activitypub'); -const utils = require('../utils'); const categoriesAPI = module.exports; From 2d49da78897764f2901039d6324b4457d3ffeb3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sun, 1 Mar 2026 15:45:32 -0500 Subject: [PATCH 4/4] fix: #14032, fix regression in room creation add test --- src/messaging/rooms.js | 2 +- test/messaging.js | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/messaging/rooms.js b/src/messaging/rooms.js index 83de1c07c7..4356775a47 100644 --- a/src/messaging/rooms.js +++ b/src/messaging/rooms.js @@ -110,7 +110,7 @@ module.exports = function (Messaging) { [`chat:room:${roomId}:uids:online`, now, uid], ...( isPublic ? - [`chat:room:${roomId}:owners`, now, uid] : + [[`chat:room:${roomId}:owners`, now, uid]] : [uid].concat(data.uids).map(uid => ([`chat:room:${roomId}:owners`, now, uid])) ), ]), diff --git a/test/messaging.js b/test/messaging.js index 4e2e709007..bbe310e27d 100644 --- a/test/messaging.js +++ b/test/messaging.js @@ -599,6 +599,20 @@ describe('Messaging Library', () => { const { roomId } = await api.users.getPrivateRoomId({ uid: mocks.users.foo.uid }, { uid: mocks.users.herp.uid }); assert(roomId); }); + + it('should create a public chat room', async () => { + const data = await api.chats.create({ + uid: mocks.users.foo.uid, + session: {}, + }, { + name: 'public room', + type: 'public', + uids: [], + groups: ['registered-users'], + }); + assert(data.roomId); + assert.strictEqual(data.public, true); + }); }); describe('toMid', () => {