diff --git a/CHANGELOG.md b/CHANGELOG.md index 94d2255224..0a21d27aa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,48 @@ +#### v3.6.3 (2024-01-12) + +##### Chores + +* incrementing version number - v3.6.2 (0f577a57) +* update changelog for v3.6.2 (82a936c3) +* incrementing version number - v3.6.1 (f1a69468) +* incrementing version number - v3.6.0 (4cdf85f8) +* incrementing version number - v3.5.3 (ed0e8783) +* incrementing version number - v3.5.2 (52fbb2da) +* incrementing version number - v3.5.1 (4c543488) +* incrementing version number - v3.5.0 (d06fb4f0) +* incrementing version number - v3.4.3 (5c984250) +* incrementing version number - v3.4.2 (3f0dac38) +* incrementing version number - v3.4.1 (01e69574) +* incrementing version number - v3.4.0 (fd9247c5) +* incrementing version number - v3.3.9 (5805e770) +* incrementing version number - v3.3.8 (a5603565) +* incrementing version number - v3.3.7 (b26f1744) +* incrementing version number - v3.3.6 (7fb38792) +* incrementing version number - v3.3.4 (a67f84ea) +* incrementing version number - v3.3.3 (f94d239b) +* incrementing version number - v3.3.2 (ec9dac97) +* incrementing version number - v3.3.1 (151cc68f) +* incrementing version number - v3.3.0 (fc1ad70f) +* incrementing version number - v3.2.3 (b06d3e63) +* incrementing version number - v3.2.2 (758ecfcd) +* incrementing version number - v3.2.1 (20145074) +* incrementing version number - v3.2.0 (9ecac38e) +* incrementing version number - v3.1.7 (0b4e81ab) +* incrementing version number - v3.1.6 (b3a3b130) +* incrementing version number - v3.1.5 (ec19343a) +* incrementing version number - v3.1.4 (2452783c) +* incrementing version number - v3.1.3 (3b4e9d3f) +* incrementing version number - v3.1.2 (40fa3489) +* incrementing version number - v3.1.1 (40250733) +* incrementing version number - v3.1.0 (0cb386bd) +* incrementing version number - v3.0.1 (26f6ea49) +* incrementing version number - v3.0.0 (224e08cd) + +##### Bug Fixes + +* #12275, pin sharp to 0.32.6 (f3927ce7) +* topic event translations closes #12273 (5f91cc83) + #### v3.6.2 (2024-01-10) ##### Chores diff --git a/public/language/en-GB/error.json b/public/language/en-GB/error.json index 75a8328aa1..7f2511747b 100644 --- a/public/language/en-GB/error.json +++ b/public/language/en-GB/error.json @@ -255,6 +255,7 @@ "no-connection": "There seems to be a problem with your internet connection", "socket-reconnect-failed": "Unable to reach the server at this time. Click here to try again, or try again later", + "invalid-plugin-id": "Invalid plugin ID", "plugin-not-whitelisted": "Unable to install plugin – only plugins whitelisted by the NodeBB Package Manager can be installed via the ACP", "plugins-set-in-configuration": "You are not allowed to change plugin state as they are defined at runtime (config.json, environmental variables or terminal arguments), please modify the configuration instead.", "theme-not-set-in-configuration": "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", diff --git a/public/src/admin/settings/navigation.js b/public/src/admin/settings/navigation.js index c858f8ccc4..375398cbee 100644 --- a/public/src/admin/settings/navigation.js +++ b/public/src/admin/settings/navigation.js @@ -100,7 +100,6 @@ define('admin/settings/navigation', [ translator.translate(li, function (li) { li = $(translator.unescape(li)); $('#enabled').append(li); - componentHandler.upgradeDom(); resolve(); }); }); diff --git a/public/src/client/topic.js b/public/src/client/topic.js index dc311d1c38..b4dd497dc3 100644 --- a/public/src/client/topic.js +++ b/public/src/client/topic.js @@ -224,7 +224,7 @@ define('forum/topic', [ btn.find('i').removeClass('fa-copy').addClass('fa-check'); setTimeout(() => btn.find('i').removeClass('fa-check').addClass('fa-copy'), 2000); const codeEl = btn.parent().find('code'); - if (codeEl.attr('data-lines')) { + if (codeEl.attr('data-lines') && codeEl.find('.hljs-ln-code[data-line-number]').length) { return codeEl.find('.hljs-ln-code[data-line-number]') .map((i, e) => e.textContent).get().join('\n'); } diff --git a/public/src/modules/navigator.js b/public/src/modules/navigator.js index 9051524370..3cf81cbe9c 100644 --- a/public/src/modules/navigator.js +++ b/public/src/modules/navigator.js @@ -353,7 +353,8 @@ define('navigator', [ } async function updateUnreadIndicator(index) { - if (!paginationBlockUnreadEl.length || ajaxify.data.postcount <= ajaxify.data.bookmarkThreshold) { + const { bookmarkThreshold } = ajaxify.data; + if (!paginationBlockUnreadEl.length || ajaxify.data.postcount <= bookmarkThreshold || !bookmarkThreshold) { return; } const currentBookmark = ajaxify.data.bookmark || storage.getItem('topic:' + ajaxify.data.tid + ':bookmark'); @@ -458,11 +459,9 @@ define('navigator', [ }; function toggle(flag) { - const path = ajaxify.removeRelativePath(window.location.pathname.slice(1)); - if (flag && (!path.startsWith('topic') && !path.startsWith('category'))) { + if (flag && (!ajaxify.data.template.topic && !ajaxify.data.template.category)) { return; } - paginationBlockEl.toggleClass('ready', flag); paginationBlockEl.toggleClass('noreplies', count <= 1); } diff --git a/public/src/modules/quickreply.js b/public/src/modules/quickreply.js index d4f59bea51..99be979319 100644 --- a/public/src/modules/quickreply.js +++ b/public/src/modules/quickreply.js @@ -2,10 +2,10 @@ define('quickreply', [ 'components', 'composer', 'composer/autocomplete', 'api', - 'alerts', 'uploadHelpers', 'mousetrap', 'storage', + 'alerts', 'uploadHelpers', 'mousetrap', 'storage', 'hooks', ], function ( components, composer, autocomplete, api, - alerts, uploadHelpers, mousetrap, storage + alerts, uploadHelpers, mousetrap, storage, hooks ) { const QuickReply = {}; @@ -91,6 +91,7 @@ define('quickreply', [ components.get('topic/quickreply/text').val(''); storage.removeItem(qrDraftId); autocomplete._active.core_qr.hide(); + hooks.fire('action:quickreply.success', { data }); }); }); diff --git a/src/plugins/install.js b/src/plugins/install.js index 91a39da76e..21d993226d 100644 --- a/src/plugins/install.js +++ b/src/plugins/install.js @@ -12,7 +12,7 @@ const request = require('../request'); const db = require('../database'); const meta = require('../meta'); const pubsub = require('../pubsub'); -const { paths } = require('../constants'); +const { paths, pluginNamePattern } = require('../constants'); const pkgInstall = require('../cli/package-install'); const packageManager = pkgInstall.getPackageManager(); @@ -60,6 +60,9 @@ module.exports = function (Plugins) { winston.error('Cannot activate plugins while plugin state is set in the configuration (config.json, environmental variables or terminal arguments), please modify the configuration instead'); throw new Error('[[error:plugins-set-in-configuration]]'); } + if (!pluginNamePattern.test(id)) { + throw new Error('[[error:invalid-plugin-id]]'); + } const isActive = await Plugins.isActive(id); if (isActive) { await db.sortedSetRemove('plugins:active', id); diff --git a/src/views/partials/data/topic.tpl b/src/views/partials/data/topic.tpl index 4c3b70640c..846d17eb40 100644 --- a/src/views/partials/data/topic.tpl +++ b/src/views/partials/data/topic.tpl @@ -1 +1 @@ -data-index="{posts.index}" data-pid="{posts.pid}" data-uid="{posts.uid}" data-timestamp="{posts.timestamp}" data-username="{posts.user.username}" data-userslug="{posts.user.userslug}"{{{ if posts.allowDupe }}} data-allow-dupe="1"{{{ end }}}{{{ if posts.navigatorIgnore }}} data-navigator-ignore="1"{{{ end }}} itemscope itemtype="http://schema.org/Comment" \ No newline at end of file +data-index="{posts.index}" data-pid="{posts.pid}" data-uid="{posts.uid}" data-timestamp="{posts.timestamp}" data-username="{posts.user.username}" data-userslug="{posts.user.userslug}"{{{ if posts.allowDupe }}} data-allow-dupe="1"{{{ end }}}{{{ if posts.navigatorIgnore }}} data-navigator-ignore="1"{{{ end }}} itemprop="comment" itemtype="http://schema.org/Comment" itemscope \ No newline at end of file diff --git a/test/plugins.js b/test/plugins.js index 1260f8fd71..582823b33a 100644 --- a/test/plugins.js +++ b/test/plugins.js @@ -262,6 +262,18 @@ describe('Plugins', () => { }); }); + it('should error if plugin id is invalid', async () => { + await assert.rejects( + plugins.toggleActive('\t\nnodebb-plugin'), + { message: '[[error:invalid-plugin-id]]' } + ); + + await assert.rejects( + plugins.toggleActive('notaplugin'), + { message: '[[error:invalid-plugin-id]]' } + ); + }); + it('should upgrade plugin', function (done) { this.timeout(0); plugins.upgrade(pluginName, 'latest', (err, isActive) => {