From f491d432731899570de520610a539f8bcd5ccd80 Mon Sep 17 00:00:00 2001 From: Misty Release Bot Date: Wed, 15 May 2024 20:36:20 +0000 Subject: [PATCH 01/10] chore: incrementing version number - v3.8.1 --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 34977a9046..38bc596bf7 100644 --- a/install/package.json +++ b/install/package.json @@ -2,7 +2,7 @@ "name": "nodebb", "license": "GPL-3.0", "description": "NodeBB Forum", - "version": "3.8.0", + "version": "3.8.1", "homepage": "https://www.nodebb.org", "repository": { "type": "git", From 5ef3e0f3a06a7c05fdbceaa3e4c32033397133c5 Mon Sep 17 00:00:00 2001 From: Misty Release Bot Date: Wed, 15 May 2024 20:36:21 +0000 Subject: [PATCH 02/10] chore: update changelog for v3.8.1 --- CHANGELOG.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df216ee9da..30c9a42afd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,64 @@ +#### v3.8.1 (2024-05-15) + +##### Chores + +* incrementing version number - v3.8.0 (e228a6eb) +* update changelog for v3.8.0 (2ef2750d) +* incrementing version number - v3.7.5 (6882894d) +* incrementing version number - v3.7.4 (6678744c) +* incrementing version number - v3.7.3 (2d62b6f6) +* incrementing version number - v3.7.2 (cc257e7e) +* incrementing version number - v3.7.1 (712365a5) +* incrementing version number - v3.7.0 (9a6153d7) +* incrementing version number - v3.6.7 (86a17e38) +* incrementing version number - v3.6.6 (6604bf37) +* incrementing version number - v3.6.5 (6c653625) +* incrementing version number - v3.6.4 (83d131b4) +* incrementing version number - v3.6.3 (fc7d2bfd) +* incrementing version number - v3.6.2 (0f577a57) +* 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 + +* wrong mention version (1d1f499b) + +##### Tests + +* use node 20 (a40f54aa) +* remove node 18 (6bd22e53) + #### v3.8.0 (2024-05-15) ##### Chores From 2c0f8c913bd219377272c44bba62e2e733fd2ab8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 16 May 2024 07:47:49 -0400 Subject: [PATCH 03/10] refactor: render --- src/middleware/render.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/middleware/render.js b/src/middleware/render.js index 21ff25170d..78d3577418 100644 --- a/src/middleware/render.js +++ b/src/middleware/render.js @@ -52,13 +52,21 @@ module.exports = function (middleware) { res.set('cache-control', 'private'); } - const buildResult = await plugins.hooks.fire(`filter:${template}.build`, { req: req, res: res, templateData: options }); + const buildResult = await plugins.hooks.fire(`filter:${template}.build`, { + req: req, + res: res, + templateData: options, + }); if (res.headersSent) { return; } const templateToRender = buildResult.templateData.templateToRender || template; - const renderResult = await plugins.hooks.fire('filter:middleware.render', { req: req, res: res, templateData: buildResult.templateData }); + const renderResult = await plugins.hooks.fire('filter:middleware.render', { + req: req, + res: res, + templateData: buildResult.templateData, + }); if (res.headersSent) { return; } From 17ea61a0ea5ada9edcb8b5624fd50fbecce56e84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Thu, 16 May 2024 12:02:43 -0400 Subject: [PATCH 04/10] chore: up harmony --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 38bc596bf7..275ae1d87d 100644 --- a/install/package.json +++ b/install/package.json @@ -103,7 +103,7 @@ "nodebb-plugin-ntfy": "1.7.4", "nodebb-plugin-spam-be-gone": "2.2.2", "nodebb-rewards-essentials": "1.0.0", - "nodebb-theme-harmony": "1.2.55", + "nodebb-theme-harmony": "1.2.56", "nodebb-theme-lavender": "7.1.8", "nodebb-theme-peace": "2.2.5", "nodebb-theme-persona": "13.3.19", From 6214336ce12a8c3c204033a063baba8e217525a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 17 May 2024 17:10:44 -0400 Subject: [PATCH 05/10] fix: update thumb count when removing thumbs --- public/src/modules/topicThumbs.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/src/modules/topicThumbs.js b/public/src/modules/topicThumbs.js index 8c4305abaa..21869fe1a5 100644 --- a/public/src/modules/topicThumbs.js +++ b/public/src/modules/topicThumbs.js @@ -87,7 +87,7 @@ define('topicThumbs', [ Thumbs.modal.handleDelete = (payload) => { const modalEl = payload.modal.get(0); - + const { id: uuid } = payload; modalEl.addEventListener('click', (ev) => { if (ev.target.closest('button[data-action="remove"]')) { bootbox.confirm('[[modules:thumbs.modal.confirm-remove]]', (ok) => { @@ -101,6 +101,9 @@ define('topicThumbs', [ path: path, }).then(() => { Thumbs.modal.open(payload); + require(['composer'], (composer) => { + composer.updateThumbCount(uuid, $(`[component="composer"][data-uuid="${uuid}"]`)); + }); }).catch(alerts.error); }); } From 83facb7df6a363fedcac604ff5c4326bc702712f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 17 May 2024 17:11:18 -0400 Subject: [PATCH 06/10] chore: up composer --- install/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install/package.json b/install/package.json index 275ae1d87d..926c7532e3 100644 --- a/install/package.json +++ b/install/package.json @@ -94,7 +94,7 @@ "multiparty": "4.2.3", "nconf": "0.12.1", "nodebb-plugin-2factor": "7.5.1", - "nodebb-plugin-composer-default": "10.2.35", + "nodebb-plugin-composer-default": "10.2.36", "nodebb-plugin-dbsearch": "6.2.3", "nodebb-plugin-emoji": "5.1.15", "nodebb-plugin-emoji-android": "4.0.0", From 56ef2bdd67c0e0f6015db804140c3ee3c58e5c32 Mon Sep 17 00:00:00 2001 From: Opliko Date: Thu, 23 May 2024 23:52:33 +0200 Subject: [PATCH 07/10] fix: reduce docker image size again and speed up build it really was just order of operations... resolves #12582 --- Dockerfile | 11 ++++++----- dev.Dockerfile | 13 +++++++------ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9778513430..f3b76ab35b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,15 +46,16 @@ ENV NODE_ENV=production \ WORKDIR /usr/src/app/ -COPY --from=build --chown=${USER}:${USER} /usr/src/app/ /usr/src/app/install/docker/setup.json /usr/src/app/ -COPY --from=build --chown=${USER}:${USER} /usr/bin/tini /usr/src/app/install/docker/entrypoint.sh /usr/local/bin/ - RUN corepack enable \ && groupadd --gid ${GID} ${USER} \ && useradd --uid ${UID} --gid ${GID} --home-dir /usr/src/app/ --shell /bin/bash ${USER} \ && mkdir -p /usr/src/app/logs/ /opt/config/ \ - && chown -R ${USER}:${USER} /usr/src/app/ /opt/config/ \ - && chmod +x /usr/local/bin/entrypoint.sh \ + && chown -R ${USER}:${USER} /usr/src/app/ /opt/config/ + +COPY --from=build --chown=${USER}:${USER} /usr/src/app/ /usr/src/app/install/docker/setup.json /usr/src/app/ +COPY --from=build --chown=${USER}:${USER} /usr/bin/tini /usr/src/app/install/docker/entrypoint.sh /usr/local/bin/ + +RUN chmod +x /usr/local/bin/entrypoint.sh \ && chmod +x /usr/local/bin/tini # TODO: Have docker-compose use environment variables to create files like setup.json and config.json. diff --git a/dev.Dockerfile b/dev.Dockerfile index a2b3867ed5..bab7d800c5 100644 --- a/dev.Dockerfile +++ b/dev.Dockerfile @@ -51,17 +51,18 @@ ENV NODE_ENV=development \ WORKDIR /usr/src/app/ +RUN corepack enable \ + && groupadd --gid ${GID} ${USER} \ + && useradd --uid ${UID} --gid ${GID} --home-dir /usr/src/app/ --shell /bin/bash ${USER} \ + && mkdir -p /usr/src/app/logs/ /opt/config/ \ + && chown -R ${USER}:${USER} /usr/src/app/ /opt/config/ + COPY --from=build --chown=${USER}:${USER} /usr/src/app/ /usr/src/app/install/docker/setup.json /usr/src/app/ COPY --from=build --chown=${USER}:${USER} /usr/bin/tini /usr/src/app/install/docker/entrypoint.sh /usr/local/bin/ COPY --from=node_modules_touch --chown=${USER}:${USER} /usr/src/app/ /usr/src/app/ COPY --from=git --chown=${USER}:${USER} /usr/src/app/ /usr/src/app/ -RUN corepack enable \ - && groupadd --gid ${GID} ${USER} \ - && useradd --uid ${UID} --gid ${GID} --home-dir /usr/src/app/ --shell /bin/bash ${USER} \ - && mkdir -p /usr/src/app/logs/ /opt/config/ \ - && chown -R ${USER}:${USER} /usr/src/app/ /opt/config/ \ - && chmod +x /usr/local/bin/entrypoint.sh \ +RUN chmod +x /usr/local/bin/entrypoint.sh \ && chmod +x /usr/local/bin/tini # TODO: Have docker-compose use environment variables to create files like setup.json and config.json. From e0515080a087b453289a76f5c1ae40d19063d889 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 24 May 2024 17:12:44 -0400 Subject: [PATCH 08/10] feat: convert "All Votes Are Public" toggle to vote visibility closes #12597 --- install/data/defaults.json | 2 +- .../en-GB/admin/settings/reputation.json | 5 ++++- src/socket.io/posts/votes.js | 9 ++++++++- src/upgrades/3.8.2/vote-visibility-config.js | 16 ++++++++++++++++ src/views/admin/settings/reputation.tpl | 10 +++++++--- 5 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 src/upgrades/3.8.2/vote-visibility-config.js diff --git a/install/data/defaults.json b/install/data/defaults.json index 6884f351b5..076a1435d0 100644 --- a/install/data/defaults.json +++ b/install/data/defaults.json @@ -137,7 +137,7 @@ "sitemapTopics": 500, "maintenanceMode": 0, "maintenanceModeStatus": 503, - "votesArePublic": 0, + "voteVisibility": "privileged", "maximumInvites": 0, "username:disableEdit": 0, "email:disableEdit": 0, diff --git a/public/language/en-GB/admin/settings/reputation.json b/public/language/en-GB/admin/settings/reputation.json index e4fff22620..a78d0e3fd5 100644 --- a/public/language/en-GB/admin/settings/reputation.json +++ b/public/language/en-GB/admin/settings/reputation.json @@ -2,7 +2,10 @@ "reputation": "Reputation Settings", "disable": "Disable Reputation System", "disable-down-voting": "Disable Down Voting", - "votes-are-public": "All Votes Are Public", + "vote-visibility": "Vote visibility", + "vote-visibility-all": "Everyone can see votes", + "vote-visibility-loggedin": "Only logged in users can see votes", + "vote-visibility-privileged": "Only privileged users like admins & moderators can see votes", "thresholds": "Activity Thresholds", "min-rep-upvote": "Minimum reputation to upvote posts", "upvotes-per-day": "Upvotes per day (set to 0 for unlimited upvotes)", diff --git a/src/socket.io/posts/votes.js b/src/socket.io/posts/votes.js index 05e2ce5198..cd0b6f3b9b 100644 --- a/src/socket.io/posts/votes.js +++ b/src/socket.io/posts/votes.js @@ -91,7 +91,14 @@ module.exports = function (SocketPosts) { ]); const cidToAllowed = _.zipObject(uniqCids, canRead); const checks = cids.map( - (cid, index) => isAdmin || isMod[index] || (cidToAllowed[cid] && !!meta.config.votesArePublic) + (cid, index) => isAdmin || isMod[index] || + ( + cidToAllowed[cid] && + ( + meta.config.voteVisibility === 'all' || + (meta.config.voteVisibility === 'loggedin' && parseInt(uid, 10) > 0) + ) + ) ); return isArray ? checks : checks[0]; } diff --git a/src/upgrades/3.8.2/vote-visibility-config.js b/src/upgrades/3.8.2/vote-visibility-config.js new file mode 100644 index 0000000000..e39b8738fa --- /dev/null +++ b/src/upgrades/3.8.2/vote-visibility-config.js @@ -0,0 +1,16 @@ +/* eslint-disable no-await-in-loop */ + +'use strict'; + +const db = require('../../database'); + +module.exports = { + name: 'Add vote visibility config field', + timestamp: Date.UTC(2024, 4, 24), + method: async function () { + const current = await db.getObjectField('config', 'votesArePublic'); + const isPublic = parseInt(current, 10) === 1; + await db.setObjectField('config', 'voteVisibility', isPublic ? 'all' : 'privileged'); + await db.deleteObjectField('config', 'votesArePublic'); + }, +}; diff --git a/src/views/admin/settings/reputation.tpl b/src/views/admin/settings/reputation.tpl index 1786596c30..b086439498 100644 --- a/src/views/admin/settings/reputation.tpl +++ b/src/views/admin/settings/reputation.tpl @@ -14,9 +14,13 @@ -
- - +
+ +
From 29dbe92d6efdf946f42dcae9f015c0d170ec792b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 25 May 2024 12:28:39 -0400 Subject: [PATCH 09/10] feat: show ignored/watched topics in topic list, closes #10974 --- install/package.json | 4 ++-- public/openapi/components/schemas/TopicObject.yaml | 2 ++ public/openapi/read/unread.yaml | 2 ++ src/topics/index.js | 9 +++++---- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/install/package.json b/install/package.json index 926c7532e3..fcfa3e1668 100644 --- a/install/package.json +++ b/install/package.json @@ -103,10 +103,10 @@ "nodebb-plugin-ntfy": "1.7.4", "nodebb-plugin-spam-be-gone": "2.2.2", "nodebb-rewards-essentials": "1.0.0", - "nodebb-theme-harmony": "1.2.56", + "nodebb-theme-harmony": "1.2.57", "nodebb-theme-lavender": "7.1.8", "nodebb-theme-peace": "2.2.5", - "nodebb-theme-persona": "13.3.19", + "nodebb-theme-persona": "13.3.20", "nodebb-widget-essentials": "7.0.16", "nodemailer": "6.9.13", "nprogress": "0.2.0", diff --git a/public/openapi/components/schemas/TopicObject.yaml b/public/openapi/components/schemas/TopicObject.yaml index ad337379f7..ee34558ffc 100644 --- a/public/openapi/components/schemas/TopicObject.yaml +++ b/public/openapi/components/schemas/TopicObject.yaml @@ -156,6 +156,8 @@ TopicObject: type: boolean ignored: type: boolean + followed: + type: boolean unread: type: boolean bookmark: diff --git a/public/openapi/read/unread.yaml b/public/openapi/read/unread.yaml index e63242729c..307a85b3b6 100644 --- a/public/openapi/read/unread.yaml +++ b/public/openapi/read/unread.yaml @@ -176,6 +176,8 @@ get: type: boolean ignored: type: boolean + followed: + type: boolean unread: type: boolean bookmark: diff --git a/src/topics/index.js b/src/topics/index.js index 3d313d08e6..59e731affe 100644 --- a/src/topics/index.js +++ b/src/topics/index.js @@ -116,10 +116,10 @@ Topics.getTopicsByTids = async function (tids, options) { }; } - const [result, hasRead, isIgnored, bookmarks, callerSettings] = await Promise.all([ + const [result, hasRead, followData, bookmarks, callerSettings] = await Promise.all([ loadTopics(), Topics.hasReadTopics(tids, uid), - Topics.isIgnoring(tids, uid), + Topics.getFollowData(tids, uid), Topics.getUserBookmarks(tids, uid), user.getSettings(uid), ]); @@ -136,8 +136,9 @@ Topics.getTopicsByTids = async function (tids, options) { } topic.teaser = result.teasers[i] || null; topic.isOwner = topic.uid === parseInt(uid, 10); - topic.ignored = isIgnored[i]; - topic.unread = parseInt(uid, 10) <= 0 || (!hasRead[i] && !isIgnored[i]); + topic.ignored = followData[i].ignoring; + topic.followed = followData[i].following; + topic.unread = parseInt(uid, 10) <= 0 || (!hasRead[i] && !topic.ignored[i]); topic.bookmark = bookmarks[i] && (sortNewToOld ? Math.max(1, topic.postcount + 2 - bookmarks[i]) : Math.min(topic.postcount, bookmarks[i] + 1)); From 7969e62d061faa1488a1bcbfdb187e586f1d6fc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Sat, 25 May 2024 12:36:04 -0400 Subject: [PATCH 10/10] fix: wrong var for ignored --- src/topics/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/topics/index.js b/src/topics/index.js index 59e731affe..5724d8a276 100644 --- a/src/topics/index.js +++ b/src/topics/index.js @@ -138,7 +138,7 @@ Topics.getTopicsByTids = async function (tids, options) { topic.isOwner = topic.uid === parseInt(uid, 10); topic.ignored = followData[i].ignoring; topic.followed = followData[i].following; - topic.unread = parseInt(uid, 10) <= 0 || (!hasRead[i] && !topic.ignored[i]); + topic.unread = parseInt(uid, 10) <= 0 || (!hasRead[i] && !topic.ignored); topic.bookmark = bookmarks[i] && (sortNewToOld ? Math.max(1, topic.postcount + 2 - bookmarks[i]) : Math.min(topic.postcount, bookmarks[i] + 1));