diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 01ca27e133..a901a4ee46 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -11,6 +11,9 @@ on: workflow_dispatch: # A workflow run is made up of one or more jobs that can run sequentially or in parallel +permissions: + contents: read + jobs: release: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 225615aa72..df9e180c78 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,8 +14,14 @@ defaults: run: shell: bash +permissions: + contents: read + jobs: test: + permissions: + checks: write # for coverallsapp/github-action to create new checks + contents: read # for actions/checkout to fetch code name: Lint and test strategy: fail-fast: false @@ -194,6 +200,8 @@ jobs: parallel: true finish: + permissions: + checks: write # for coverallsapp/github-action to create new checks needs: test runs-on: ubuntu-latest steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 312cd0d726..2fa3d9ec12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,35 @@ +#### v2.5.3 (2022-09-19) + +##### Chores + +* remove duplicate version increment lines in changelog (5dbcfef9) +* bring back treding plugins (8aa1596d) +* incrementing version number - v2.5.2 (babcd17e) +* update changelog for v2.5.2 (84b6a7c7) + +##### New Features + +* store topic title and tags in diffs (#10900) (b5dd89e1) + +##### Bug Fixes + +* #10906, allow `middleware.checkAccountPermissions` to be called with either uid or userslug in params (cf4f5447) +* #10896, unescape / in taskbar (8e2129f8) +* add back timeago to post history modal (d3e38df8) +* **deps:** bump composer-default to v9.1.1 (1d80a07e) + +##### Other Changes + +* fix lint (3d5a6b39) + +##### Performance Improvements + +* disable trending plugins, too slow due to nbbpm (b392450c) + +##### Tests + +* add back /admin/extend/plugins test (1c9c39a8) + #### v2.5.2 (2022-09-04) ##### Chores diff --git a/public/src/admin/manage/categories.js b/public/src/admin/manage/categories.js index cae9f782ca..d5eb350038 100644 --- a/public/src/admin/manage/categories.js +++ b/public/src/admin/manage/categories.js @@ -212,11 +212,17 @@ define('admin/manage/categories', [ const oldParentCid = parseInt(e.from.getAttribute('data-cid'), 10); const newParentCid = parseInt(e.to.getAttribute('data-cid'), 10); if (oldParentCid !== newParentCid) { - document.querySelector(`.categories li[data-cid="${newParentCid}"] .toggle`).classList.toggle('hide', false); + const toggle = document.querySelector(`.categories li[data-cid="${newParentCid}"] .toggle`); + if (toggle) { + toggle.classList.toggle('hide', false); + } const children = document.querySelectorAll(`.categories li[data-cid="${oldParentCid}"] ul[data-cid] li[data-cid]`); if (!children.length) { - document.querySelector(`.categories li[data-cid="${oldParentCid}"] .toggle`).classList.toggle('hide', true); + const toggle = document.querySelector(`.categories li[data-cid="${oldParentCid}"] .toggle`); + if (toggle) { + toggle.classList.toggle('hide', true); + } } e.item.dataset.parentCid = newParentCid; diff --git a/public/src/client/flags/detail.js b/public/src/client/flags/detail.js index fdffc096f2..782304f318 100644 --- a/public/src/client/flags/detail.js +++ b/public/src/client/flags/detail.js @@ -26,7 +26,7 @@ define('forum/flags/detail', [ return memo; }, {}); - api.put(`/flags/${ajaxify.data.flagId}`, data).then((history) => { + api.put(`/flags/${ajaxify.data.flagId}`, data).then(({ history }) => { alerts.success('[[flags:updated]]'); Detail.reloadHistory(history); }).catch(alerts.error); diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index 824f55434a..2937470707 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -559,7 +559,7 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], funct } const postHeight = scrollTo.outerHeight(true); - const navbarHeight = components.get('navbar').outerHeight(true); + const navbarHeight = components.get('navbar').outerHeight(true) || 0; const topicHeaderHeight = $('.topic-header').outerHeight(true) || 0; const viewportHeight = $(window).height(); diff --git a/src/categories/update.js b/src/categories/update.js index 20b14361fb..d4be83edb8 100644 --- a/src/categories/update.js +++ b/src/categories/update.js @@ -108,7 +108,7 @@ module.exports = function (Categories) { if (currentIndex === -1) { throw new Error('[[error:no-category]]'); } - // moves cid to index order-1 in the array + // moves cid to index order - 1 in the array if (childrenCids.length > 1) { childrenCids.splice(Math.max(0, order - 1), 0, childrenCids.splice(currentIndex, 1)[0]); } diff --git a/src/cli/index.js b/src/cli/index.js index 5c3c01fd88..86bfc127b4 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -41,6 +41,7 @@ try { checkVersion('commander'); checkVersion('chalk'); checkVersion('lodash'); + checkVersion('lru-cache'); } catch (e) { if (['ENOENT', 'DEP_WRONG_VERSION', 'MODULE_NOT_FOUND'].includes(e.code)) { console.warn('Dependencies outdated or not yet installed.'); diff --git a/src/meta/js.js b/src/meta/js.js index 69ab76f369..454b682cc3 100644 --- a/src/meta/js.js +++ b/src/meta/js.js @@ -27,14 +27,6 @@ JS.scripts = { modules: { }, }; -async function linkIfLinux(srcPath, destPath) { - if (process.platform === 'win32') { - await fs.promises.copyFile(srcPath, destPath); - } else { - await file.link(srcPath, destPath, true); - } -} - const basePath = path.resolve(__dirname, '../..'); async function linkModules() { @@ -55,7 +47,7 @@ async function linkModules() { if (stats.isDirectory()) { await file.linkDirs(srcPath, destPath, true); } else { - await linkIfLinux(srcPath, destPath); + await fs.promises.copyFile(srcPath, destPath); } })); } diff --git a/test/categories.js b/test/categories.js index 98d15c28bc..cd28ee33ef 100644 --- a/test/categories.js +++ b/test/categories.js @@ -421,6 +421,22 @@ describe('Categories', () => { assert.equal(data.icon, updateData[cid].icon); }); + it('should properly order categories', async () => { + const p1 = await Categories.create({ name: 'p1', description: 'd', parentCid: 0, order: 1 }); + const c1 = await Categories.create({ name: 'c1', description: 'd1', parentCid: p1.cid, order: 1 }); + const c2 = await Categories.create({ name: 'c2', description: 'd2', parentCid: p1.cid, order: 2 }); + const c3 = await Categories.create({ name: 'c3', description: 'd3', parentCid: p1.cid, order: 3 }); + // move c1 to second place + await apiCategories.update({ uid: adminUid }, { [c1.cid]: { order: 2 } }); + let cids = await db.getSortedSetRange(`cid:${p1.cid}:children`, 0, -1); + assert.deepStrictEqual(cids.map(Number), [c2.cid, c1.cid, c3.cid]); + + // move c3 to front + await apiCategories.update({ uid: adminUid }, { [c3.cid]: { order: 1 } }); + cids = await db.getSortedSetRange(`cid:${p1.cid}:children`, 0, -1); + assert.deepStrictEqual(cids.map(Number), [c3.cid, c2.cid, c1.cid]); + }); + it('should not remove category from parent if parent is set again to same category', async () => { const parentCat = await Categories.create({ name: 'parent', description: 'poor parent' }); const updateData = {};