Merge commit 'ebd5dcc6d62841dbcd120351919cdf7cf59f5933' into v2.x

isekai-main
Misty Release Bot 2 years ago
commit 4bf1ce42e6

@ -11,6 +11,9 @@ on:
workflow_dispatch: workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel # A workflow run is made up of one or more jobs that can run sequentially or in parallel
permissions:
contents: read
jobs: jobs:
release: release:
runs-on: ubuntu-latest runs-on: ubuntu-latest

@ -14,8 +14,14 @@ defaults:
run: run:
shell: bash shell: bash
permissions:
contents: read
jobs: jobs:
test: test:
permissions:
checks: write # for coverallsapp/github-action to create new checks
contents: read # for actions/checkout to fetch code
name: Lint and test name: Lint and test
strategy: strategy:
fail-fast: false fail-fast: false
@ -194,6 +200,8 @@ jobs:
parallel: true parallel: true
finish: finish:
permissions:
checks: write # for coverallsapp/github-action to create new checks
needs: test needs: test
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:

@ -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) #### v2.5.2 (2022-09-04)
##### Chores ##### Chores

@ -212,11 +212,17 @@ define('admin/manage/categories', [
const oldParentCid = parseInt(e.from.getAttribute('data-cid'), 10); const oldParentCid = parseInt(e.from.getAttribute('data-cid'), 10);
const newParentCid = parseInt(e.to.getAttribute('data-cid'), 10); const newParentCid = parseInt(e.to.getAttribute('data-cid'), 10);
if (oldParentCid !== newParentCid) { 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]`); const children = document.querySelectorAll(`.categories li[data-cid="${oldParentCid}"] ul[data-cid] li[data-cid]`);
if (!children.length) { 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; e.item.dataset.parentCid = newParentCid;

@ -26,7 +26,7 @@ define('forum/flags/detail', [
return memo; return memo;
}, {}); }, {});
api.put(`/flags/${ajaxify.data.flagId}`, data).then((history) => { api.put(`/flags/${ajaxify.data.flagId}`, data).then(({ history }) => {
alerts.success('[[flags:updated]]'); alerts.success('[[flags:updated]]');
Detail.reloadHistory(history); Detail.reloadHistory(history);
}).catch(alerts.error); }).catch(alerts.error);

@ -559,7 +559,7 @@ define('navigator', ['forum/pagination', 'components', 'hooks', 'alerts'], funct
} }
const postHeight = scrollTo.outerHeight(true); 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 topicHeaderHeight = $('.topic-header').outerHeight(true) || 0;
const viewportHeight = $(window).height(); const viewportHeight = $(window).height();

@ -108,7 +108,7 @@ module.exports = function (Categories) {
if (currentIndex === -1) { if (currentIndex === -1) {
throw new Error('[[error:no-category]]'); 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) { if (childrenCids.length > 1) {
childrenCids.splice(Math.max(0, order - 1), 0, childrenCids.splice(currentIndex, 1)[0]); childrenCids.splice(Math.max(0, order - 1), 0, childrenCids.splice(currentIndex, 1)[0]);
} }

@ -41,6 +41,7 @@ try {
checkVersion('commander'); checkVersion('commander');
checkVersion('chalk'); checkVersion('chalk');
checkVersion('lodash'); checkVersion('lodash');
checkVersion('lru-cache');
} catch (e) { } catch (e) {
if (['ENOENT', 'DEP_WRONG_VERSION', 'MODULE_NOT_FOUND'].includes(e.code)) { if (['ENOENT', 'DEP_WRONG_VERSION', 'MODULE_NOT_FOUND'].includes(e.code)) {
console.warn('Dependencies outdated or not yet installed.'); console.warn('Dependencies outdated or not yet installed.');

@ -27,14 +27,6 @@ JS.scripts = {
modules: { }, 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, '../..'); const basePath = path.resolve(__dirname, '../..');
async function linkModules() { async function linkModules() {
@ -55,7 +47,7 @@ async function linkModules() {
if (stats.isDirectory()) { if (stats.isDirectory()) {
await file.linkDirs(srcPath, destPath, true); await file.linkDirs(srcPath, destPath, true);
} else { } else {
await linkIfLinux(srcPath, destPath); await fs.promises.copyFile(srcPath, destPath);
} }
})); }));
} }

@ -421,6 +421,22 @@ describe('Categories', () => {
assert.equal(data.icon, updateData[cid].icon); 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 () => { 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 parentCat = await Categories.create({ name: 'parent', description: 'poor parent' });
const updateData = {}; const updateData = {};

Loading…
Cancel
Save