diff --git a/CHANGELOG.md b/CHANGELOG.md index e07cc91229..b99f4b090f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,27 @@ +#### v2.8.11 (2023-04-11) + +##### Chores + +* incrementing version number - v2.8.10 (5b7c3671) +* update changelog for v2.8.10 (188ec62f) + +##### Continuous Integration + +* publish to ghcr instead of docker hub (c2756728) + +##### Documentation Changes + +* update readme with new screenshot and updated copy for Harmony (67055006) + +##### Bug Fixes + +* don't crash on objects with toString property (4d2d7689) +* fire action:user.online on user login (7397873d) + +##### Tests + +* update socket.io test (e0b20658) + #### v2.8.10 (2023-03-27) ##### Chores @@ -5,35 +29,6 @@ * up composer-default (e9a8e195) * incrementing version number - v2.8.9 (57f14e41) * update changelog for v2.8.9 (18b2150e) -* incrementing version number - v2.8.8 (b331b942) -* incrementing version number - v2.8.7 (3f8248d6) -* incrementing version number - v2.8.6 (af6ce447) -* incrementing version number - v2.8.5 (bff5ce2d) -* incrementing version number - v2.8.4 (a46b2bbc) -* incrementing version number - v2.8.3 (c20b20a7) -* incrementing version number - v2.8.2 (050e43f8) -* incrementing version number - v2.8.1 (727f879e) -* incrementing version number - v2.8.0 (8e77673d) -* incrementing version number - v2.7.0 (96cc0617) -* incrementing version number - v2.6.1 (7e52a7a5) -* incrementing version number - v2.6.0 (e7fcf482) -* incrementing version number - v2.5.8 (dec0e7de) -* incrementing version number - v2.5.7 (5836bf4a) -* incrementing version number - v2.5.6 (c7bd7dbf) -* incrementing version number - v2.5.5 (3509ed94) -* incrementing version number - v2.5.4 (e83260ca) -* incrementing version number - v2.5.3 (7e922936) -* incrementing version number - v2.5.2 (babcd17e) -* incrementing version number - v2.5.1 (ce3aa950) -* incrementing version number - v2.5.0 (01d276cb) -* incrementing version number - v2.4.5 (dd3e1a28) -* incrementing version number - v2.4.4 (d5525c87) -* incrementing version number - v2.4.3 (9c647c6c) -* incrementing version number - v2.4.2 (3aa7b855) -* incrementing version number - v2.4.1 (60cbd148) -* incrementing version number - v2.4.0 (4834cde3) -* incrementing version number - v2.3.1 (d2425942) -* incrementing version number - v2.3.0 (046ea120) ##### Bug Fixes @@ -53,34 +48,6 @@ * up cron (73a50d17) * incrementing version number - v2.8.8 (b331b942) * update changelog for v2.8.8 (c03d5db7) -* incrementing version number - v2.8.7 (3f8248d6) -* incrementing version number - v2.8.6 (af6ce447) -* incrementing version number - v2.8.5 (bff5ce2d) -* incrementing version number - v2.8.4 (a46b2bbc) -* incrementing version number - v2.8.3 (c20b20a7) -* incrementing version number - v2.8.2 (050e43f8) -* incrementing version number - v2.8.1 (727f879e) -* incrementing version number - v2.8.0 (8e77673d) -* incrementing version number - v2.7.0 (96cc0617) -* incrementing version number - v2.6.1 (7e52a7a5) -* incrementing version number - v2.6.0 (e7fcf482) -* incrementing version number - v2.5.8 (dec0e7de) -* incrementing version number - v2.5.7 (5836bf4a) -* incrementing version number - v2.5.6 (c7bd7dbf) -* incrementing version number - v2.5.5 (3509ed94) -* incrementing version number - v2.5.4 (e83260ca) -* incrementing version number - v2.5.3 (7e922936) -* incrementing version number - v2.5.2 (babcd17e) -* incrementing version number - v2.5.1 (ce3aa950) -* incrementing version number - v2.5.0 (01d276cb) -* incrementing version number - v2.4.5 (dd3e1a28) -* incrementing version number - v2.4.4 (d5525c87) -* incrementing version number - v2.4.3 (9c647c6c) -* incrementing version number - v2.4.2 (3aa7b855) -* incrementing version number - v2.4.1 (60cbd148) -* incrementing version number - v2.4.0 (4834cde3) -* incrementing version number - v2.3.1 (d2425942) -* incrementing version number - v2.3.0 (046ea120) ##### Bug Fixes @@ -103,33 +70,6 @@ * incrementing version number - v2.8.7 (3f8248d6) * update changelog for v2.8.7 (2ca38e7b) -* incrementing version number - v2.8.6 (af6ce447) -* incrementing version number - v2.8.5 (bff5ce2d) -* incrementing version number - v2.8.4 (a46b2bbc) -* incrementing version number - v2.8.3 (c20b20a7) -* incrementing version number - v2.8.2 (050e43f8) -* incrementing version number - v2.8.1 (727f879e) -* incrementing version number - v2.8.0 (8e77673d) -* incrementing version number - v2.7.0 (96cc0617) -* incrementing version number - v2.6.1 (7e52a7a5) -* incrementing version number - v2.6.0 (e7fcf482) -* incrementing version number - v2.5.8 (dec0e7de) -* incrementing version number - v2.5.7 (5836bf4a) -* incrementing version number - v2.5.6 (c7bd7dbf) -* incrementing version number - v2.5.5 (3509ed94) -* incrementing version number - v2.5.4 (e83260ca) -* incrementing version number - v2.5.3 (7e922936) -* incrementing version number - v2.5.2 (babcd17e) -* incrementing version number - v2.5.1 (ce3aa950) -* incrementing version number - v2.5.0 (01d276cb) -* incrementing version number - v2.4.5 (dd3e1a28) -* incrementing version number - v2.4.4 (d5525c87) -* incrementing version number - v2.4.3 (9c647c6c) -* incrementing version number - v2.4.2 (3aa7b855) -* incrementing version number - v2.4.1 (60cbd148) -* incrementing version number - v2.4.0 (4834cde3) -* incrementing version number - v2.3.1 (d2425942) -* incrementing version number - v2.3.0 (046ea120) ##### Bug Fixes @@ -145,32 +85,6 @@ * incrementing version number - v2.8.6 (af6ce447) * update changelog for v2.8.6 (f3306d03) -* incrementing version number - v2.8.5 (bff5ce2d) -* incrementing version number - v2.8.4 (a46b2bbc) -* incrementing version number - v2.8.3 (c20b20a7) -* incrementing version number - v2.8.2 (050e43f8) -* incrementing version number - v2.8.1 (727f879e) -* incrementing version number - v2.8.0 (8e77673d) -* incrementing version number - v2.7.0 (96cc0617) -* incrementing version number - v2.6.1 (7e52a7a5) -* incrementing version number - v2.6.0 (e7fcf482) -* incrementing version number - v2.5.8 (dec0e7de) -* incrementing version number - v2.5.7 (5836bf4a) -* incrementing version number - v2.5.6 (c7bd7dbf) -* incrementing version number - v2.5.5 (3509ed94) -* incrementing version number - v2.5.4 (e83260ca) -* incrementing version number - v2.5.3 (7e922936) -* incrementing version number - v2.5.2 (babcd17e) -* incrementing version number - v2.5.1 (ce3aa950) -* incrementing version number - v2.5.0 (01d276cb) -* incrementing version number - v2.4.5 (dd3e1a28) -* incrementing version number - v2.4.4 (d5525c87) -* incrementing version number - v2.4.3 (9c647c6c) -* incrementing version number - v2.4.2 (3aa7b855) -* incrementing version number - v2.4.1 (60cbd148) -* incrementing version number - v2.4.0 (4834cde3) -* incrementing version number - v2.3.1 (d2425942) -* incrementing version number - v2.3.0 (046ea120) ##### Documentation Changes @@ -199,31 +113,6 @@ * **i18n:** fallback strings for new resources: nodebb.error (8335f90a) * incrementing version number - v2.8.5 (bff5ce2d) * update changelog for v2.8.5 (24e58c28) -* incrementing version number - v2.8.4 (a46b2bbc) -* incrementing version number - v2.8.3 (c20b20a7) -* incrementing version number - v2.8.2 (050e43f8) -* incrementing version number - v2.8.1 (727f879e) -* incrementing version number - v2.8.0 (8e77673d) -* incrementing version number - v2.7.0 (96cc0617) -* incrementing version number - v2.6.1 (7e52a7a5) -* incrementing version number - v2.6.0 (e7fcf482) -* incrementing version number - v2.5.8 (dec0e7de) -* incrementing version number - v2.5.7 (5836bf4a) -* incrementing version number - v2.5.6 (c7bd7dbf) -* incrementing version number - v2.5.5 (3509ed94) -* incrementing version number - v2.5.4 (e83260ca) -* incrementing version number - v2.5.3 (7e922936) -* incrementing version number - v2.5.2 (babcd17e) -* incrementing version number - v2.5.1 (ce3aa950) -* incrementing version number - v2.5.0 (01d276cb) -* incrementing version number - v2.4.5 (dd3e1a28) -* incrementing version number - v2.4.4 (d5525c87) -* incrementing version number - v2.4.3 (9c647c6c) -* incrementing version number - v2.4.2 (3aa7b855) -* incrementing version number - v2.4.1 (60cbd148) -* incrementing version number - v2.4.0 (4834cde3) -* incrementing version number - v2.3.1 (d2425942) -* incrementing version number - v2.3.0 (046ea120) ##### New Features @@ -249,30 +138,6 @@ * incrementing version number - v2.8.4 (a46b2bbc) * update changelog for v2.8.4 (c13f0e21) -* incrementing version number - v2.8.3 (c20b20a7) -* incrementing version number - v2.8.2 (050e43f8) -* incrementing version number - v2.8.1 (727f879e) -* incrementing version number - v2.8.0 (8e77673d) -* incrementing version number - v2.7.0 (96cc0617) -* incrementing version number - v2.6.1 (7e52a7a5) -* incrementing version number - v2.6.0 (e7fcf482) -* incrementing version number - v2.5.8 (dec0e7de) -* incrementing version number - v2.5.7 (5836bf4a) -* incrementing version number - v2.5.6 (c7bd7dbf) -* incrementing version number - v2.5.5 (3509ed94) -* incrementing version number - v2.5.4 (e83260ca) -* incrementing version number - v2.5.3 (7e922936) -* incrementing version number - v2.5.2 (babcd17e) -* incrementing version number - v2.5.1 (ce3aa950) -* incrementing version number - v2.5.0 (01d276cb) -* incrementing version number - v2.4.5 (dd3e1a28) -* incrementing version number - v2.4.4 (d5525c87) -* incrementing version number - v2.4.3 (9c647c6c) -* incrementing version number - v2.4.2 (3aa7b855) -* incrementing version number - v2.4.1 (60cbd148) -* incrementing version number - v2.4.0 (4834cde3) -* incrementing version number - v2.3.1 (d2425942) -* incrementing version number - v2.3.0 (046ea120) ##### Bug Fixes @@ -284,29 +149,6 @@ * incrementing version number - v2.8.3 (c20b20a7) * update changelog for v2.8.3 (eb2841ee) -* incrementing version number - v2.8.2 (050e43f8) -* incrementing version number - v2.8.1 (727f879e) -* incrementing version number - v2.8.0 (8e77673d) -* incrementing version number - v2.7.0 (96cc0617) -* incrementing version number - v2.6.1 (7e52a7a5) -* incrementing version number - v2.6.0 (e7fcf482) -* incrementing version number - v2.5.8 (dec0e7de) -* incrementing version number - v2.5.7 (5836bf4a) -* incrementing version number - v2.5.6 (c7bd7dbf) -* incrementing version number - v2.5.5 (3509ed94) -* incrementing version number - v2.5.4 (e83260ca) -* incrementing version number - v2.5.3 (7e922936) -* incrementing version number - v2.5.2 (babcd17e) -* incrementing version number - v2.5.1 (ce3aa950) -* incrementing version number - v2.5.0 (01d276cb) -* incrementing version number - v2.4.5 (dd3e1a28) -* incrementing version number - v2.4.4 (d5525c87) -* incrementing version number - v2.4.3 (9c647c6c) -* incrementing version number - v2.4.2 (3aa7b855) -* incrementing version number - v2.4.1 (60cbd148) -* incrementing version number - v2.4.0 (4834cde3) -* incrementing version number - v2.3.1 (d2425942) -* incrementing version number - v2.3.0 (046ea120) #### v2.8.3 (2023-01-25) @@ -315,28 +157,6 @@ * remove extraneous lines from changelog (48c9f447) * incrementing version number - v2.8.2 (050e43f8) * update changelog for v2.8.2 (66aa3169) -* incrementing version number - v2.8.1 (727f879e) -* incrementing version number - v2.8.0 (8e77673d) -* incrementing version number - v2.7.0 (96cc0617) -* incrementing version number - v2.6.1 (7e52a7a5) -* incrementing version number - v2.6.0 (e7fcf482) -* incrementing version number - v2.5.8 (dec0e7de) -* incrementing version number - v2.5.7 (5836bf4a) -* incrementing version number - v2.5.6 (c7bd7dbf) -* incrementing version number - v2.5.5 (3509ed94) -* incrementing version number - v2.5.4 (e83260ca) -* incrementing version number - v2.5.3 (7e922936) -* incrementing version number - v2.5.2 (babcd17e) -* incrementing version number - v2.5.1 (ce3aa950) -* incrementing version number - v2.5.0 (01d276cb) -* incrementing version number - v2.4.5 (dd3e1a28) -* incrementing version number - v2.4.4 (d5525c87) -* incrementing version number - v2.4.3 (9c647c6c) -* incrementing version number - v2.4.2 (3aa7b855) -* incrementing version number - v2.4.1 (60cbd148) -* incrementing version number - v2.4.0 (4834cde3) -* incrementing version number - v2.3.1 (d2425942) -* incrementing version number - v2.3.0 (046ea120) ##### Bug Fixes diff --git a/src/categories/create.js b/src/categories/create.js index ce3f01f22e..c2f7fb7968 100644 --- a/src/categories/create.js +++ b/src/categories/create.js @@ -95,11 +95,9 @@ module.exports = function (Categories) { await privileges.categories.give(result.modPrivileges, category.cid, ['administrators', 'Global Moderators']); await privileges.categories.give(result.guestPrivileges, category.cid, ['guests', 'spiders']); - cache.del([ - 'categories:cid', - `cid:${parentCid}:children`, - `cid:${parentCid}:children:all`, - ]); + cache.del('categories:cid'); + await clearParentCategoryCache(parentCid); + if (data.cloneFromCid && parseInt(data.cloneFromCid, 10)) { category = await Categories.copySettingsFrom(data.cloneFromCid, category.cid, !data.parentCid); } @@ -112,6 +110,22 @@ module.exports = function (Categories) { return category; }; + async function clearParentCategoryCache(parentCid) { + while (parseInt(parentCid, 10) >= 0) { + cache.del([ + `cid:${parentCid}:children`, + `cid:${parentCid}:children:all`, + ]); + + if (parseInt(parentCid, 10) === 0) { + return; + } + // clear all the way to root + // eslint-disable-next-line no-await-in-loop + parentCid = await Categories.getCategoryField(parentCid, 'parentCid'); + } + } + async function duplicateCategoriesChildren(parentCid, cid, uid) { let children = await Categories.getChildren([cid], uid); if (!children.length) { diff --git a/src/meta/themes.js b/src/meta/themes.js index d4d3f58f45..0af75640c9 100644 --- a/src/meta/themes.js +++ b/src/meta/themes.js @@ -108,7 +108,7 @@ Themes.set = async (data) => { await db.sortedSetAdd('plugins:active', numPlugins, data.id); } else if (!activePluginsConfig.includes(data.id)) { // This prevents changing theme when configuration doesn't include it, but allows it otherwise - winston.error('When defining active plugins in configuration, changing themes requires adding the new theme to the list of active plugins before updating it in the ACP'); + winston.error(`When defining active plugins in configuration, changing themes requires adding the theme '${data.id}' to the list of active plugins before updating it in the ACP`); throw new Error('[[error:theme-not-set-in-configuration]]'); } diff --git a/src/middleware/index.js b/src/middleware/index.js index 96bd3da398..e4c8cc98ec 100644 --- a/src/middleware/index.js +++ b/src/middleware/index.js @@ -102,11 +102,20 @@ middleware.pluginHooks = helpers.try(async (req, res, next) => { }); middleware.validateFiles = function validateFiles(req, res, next) { - if (!Array.isArray(req.files.files) || !req.files.files.length) { + if (!req.files.files) { return next(new Error(['[[error:invalid-files]]'])); } - next(); + if (Array.isArray(req.files.files) && req.files.files.length) { + return next(); + } + + if (typeof req.files.files === 'object') { + req.files.files = [req.files.files]; + return next(); + } + + return next(new Error(['[[error:invalid-files]]'])); }; middleware.prepareAPI = function prepareAPI(req, res, next) { diff --git a/src/topics/tags.js b/src/topics/tags.js index 314b5cfd84..3b17027672 100644 --- a/src/topics/tags.js +++ b/src/topics/tags.js @@ -232,10 +232,15 @@ module.exports = function (Topics) { if (!tids.length) { return; } + let topicsTags = await Topics.getTopicsTags(tids); + topicsTags = topicsTags.map( + topicTags => topicTags.filter(topicTag => topicTag && topicTag !== tag) + ); - await db.deleteObjectFields( - tids.map(tid => `topic:${tid}`), - ['tags'], + await db.setObjectBulk( + tids.map((tid, index) => ([ + `topic:${tid}`, { tags: topicsTags[index].join(',') }, + ])) ); }); } diff --git a/test/helpers/index.js b/test/helpers/index.js index 6ca11e9252..dd52e35f80 100644 --- a/test/helpers/index.js +++ b/test/helpers/index.js @@ -121,7 +121,6 @@ helpers.uploadFile = function (uploadEndPoint, filePath, body, jar, csrf_token, let formData = { files: [ fs.createReadStream(filePath), - fs.createReadStream(filePath), // see https://github.com/request/request/issues/2445 ], }; formData = utils.merge(formData, body); diff --git a/test/topics.js b/test/topics.js index 44587639bc..f27ed80ad4 100644 --- a/test/topics.js +++ b/test/topics.js @@ -1932,6 +1932,14 @@ describe('Topic\'s', () => { }); }); + it('should only delete one tag from topic', async () => { + const result1 = await topics.post({ uid: adminUid, tags: ['deleteme1', 'deleteme2', 'deleteme3'], title: 'topic tagged with plugins', content: 'topic 1 content', cid: topic.categoryId }); + await topics.deleteTag('deleteme2'); + const topicData = await topics.getTopicData(result1.topicData.tid); + const tags = topicData.tags.map(t => t.value); + assert.deepStrictEqual(tags, ['deleteme1', 'deleteme3']); + }); + it('should delete tag', (done) => { topics.deleteTag('javascript', (err) => { assert.ifError(err); diff --git a/test/uploads.js b/test/uploads.js index 5be0818b5e..1eecfe9f1f 100644 --- a/test/uploads.js +++ b/test/uploads.js @@ -87,8 +87,7 @@ describe('Upload Controllers', () => { const oldValue = meta.config.allowedFileExtensions; meta.config.allowedFileExtensions = 'png,jpg,bmp,html'; require('../src/middleware/uploads').clearCache(); - // why / 2? see: helpers.uploadFile for a weird quirk where we actually upload 2 files per upload in our tests. - const times = (meta.config.uploadRateLimitThreshold / 2) + 1; + const times = meta.config.uploadRateLimitThreshold + 1; async.timesSeries(times, (i, next) => { helpers.uploadFile(`${nconf.get('url')}/api/post/upload`, path.join(__dirname, '../test/files/503.html'), {}, jar, csrf_token, (err, res, body) => { if (i + 1 >= times) { @@ -522,7 +521,7 @@ describe('Upload Controllers', () => { it('should return files with no post associated with them', async () => { const orphans = await posts.uploads.getOrphans(); - assert.strictEqual(orphans.length, 2); + assert.strictEqual(orphans.length, 1); orphans.forEach((relPath) => { assert(relPath.startsWith('files/')); assert(relPath.endsWith('test.png')); @@ -553,7 +552,7 @@ describe('Upload Controllers', () => { await posts.uploads.cleanOrphans(); const orphans = await posts.uploads.getOrphans(); - assert.strictEqual(orphans.length, 2); + assert.strictEqual(orphans.length, 1); }); it('should not touch orphans if they are newer than the configured expiry', async () => { @@ -561,7 +560,7 @@ describe('Upload Controllers', () => { await posts.uploads.cleanOrphans(); const orphans = await posts.uploads.getOrphans(); - assert.strictEqual(orphans.length, 2); + assert.strictEqual(orphans.length, 1); }); it('should delete orphans older than the configured number of days', async () => {