Compare commits

...

24 Commits

Author SHA1 Message Date
renovate[bot]
e771a02d7d chore(deps): update dependency husky to v9 2025-12-13 15:38:05 +00:00
renovate[bot]
ad895efb61 chore(deps): update dependency smtp-server to v3.17.1 (#13829)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-13 10:36:23 -05:00
renovate[bot]
22fe83f005 chore(deps): update dependency @eslint/js to v9.39.2 (#13830)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-13 10:36:13 -05:00
renovate[bot]
b169621860 chore(deps): update github artifact actions (#13831)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-13 10:36:02 -05:00
renovate[bot]
da7c9b32b8 fix(deps): update dependency terser-webpack-plugin to v5.3.16 (#13827)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-12 07:56:00 -05:00
renovate[bot]
0fcc8543c6 chore(deps): update actions/cache action to v5 (#13828)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-12 07:55:41 -05:00
Barış Soner Uşaklı
ed977c48b4 Merge branch 'master' into develop 2025-12-11 21:25:56 -05:00
Barış Soner Uşaklı
f49f540bfa fix: show errors when saving settings 2025-12-11 21:25:42 -05:00
Julian Lam
20918b5281 fix: wrong increment value 2025-12-11 11:10:29 -05:00
Julian Lam
8abe0dfa9f fix: increment progress on upgrade script 2025-12-11 11:09:13 -05:00
Julian Lam
097d0802b7 feat: stop extraneous vote and tids_read data from being saved for remote users 2025-12-11 10:57:00 -05:00
renovate[bot]
3adcbe0f7d chore(deps): update dependency smtp-server to v3.17.0 (#13824)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-11 10:34:57 -05:00
renovate[bot]
b992511bb9 chore(deps): update dependency sass-embedded to v1.96.0 (#13821)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-11 10:13:51 -05:00
renovate[bot]
d4f53a6242 fix(deps): update dependency sass to v1.96.0 (#13822)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-11 10:13:35 -05:00
Julian Lam
528cd258c4 feat: support remote Dislike activity, federate out a Dislike on downvote, bwahahah 2025-12-10 12:40:46 -05:00
renovate[bot]
a2f2c8c761 chore(deps): update dependency sass-embedded to v1.95.1 (#13817)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-09 20:04:25 -05:00
renovate[bot]
81c232f181 fix(deps): update dependency winston to v3.19.0 (#13812)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-09 19:47:59 -05:00
renovate[bot]
f077c4cab8 fix(deps): update dependency cron to v4.4.0 (#13818)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-09 19:46:55 -05:00
renovate[bot]
adedb7b626 fix(deps): update dependency sass to v1.95.1 (#13816)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-09 19:46:11 -05:00
renovate[bot]
a35c326a6c chore(deps): update dependency jsdom to v27.3.0 (#13814)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-09 19:25:06 -05:00
renovate[bot]
eaa6e71a99 fix(deps): update dependency sass to v1.95.0 (#13815)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-09 19:24:47 -05:00
Barış Soner Uşaklı
011f8b2465 Merge branch 'master' into develop 2025-12-08 10:19:00 -05:00
Barış Soner Uşaklı
b19281b061 revert: spec change 2025-12-08 10:18:38 -05:00
Barış Soner Uşaklı
9d6665505e chore: up widget-essentials 2025-12-08 09:43:50 -05:00
11 changed files with 171 additions and 46 deletions

View File

@@ -53,7 +53,7 @@ jobs:
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: var-cache-node-modules
key: var-cache-node-modules-${{ hashFiles('Dockerfile', 'install/package.json') }}
@@ -77,7 +77,7 @@ jobs:
touch "${{ runner.temp }}/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v5
uses: actions/upload-artifact@v6
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: ${{ runner.temp }}/digests/*
@@ -93,7 +93,7 @@ jobs:
echo "IMAGE=ghcr.io/${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV
echo "CURRENT_DATE_NST=$(date +'%Y%m%d-%H%M%S' -d '-3 hours -30 minutes')" >> $GITHUB_ENV
- name: Download digests
uses: actions/download-artifact@v6
uses: actions/download-artifact@v7
with:
path: ${{ runner.temp }}/digests
pattern: digests-*

View File

@@ -61,7 +61,7 @@
"connect-pg-simple": "10.0.0",
"connect-redis": "9.0.0",
"cookie-parser": "1.4.7",
"cron": "4.3.5",
"cron": "4.4.0",
"cropperjs": "1.6.2",
"csrf-sync": "4.2.1",
"daemon": "1.1.0",
@@ -111,7 +111,7 @@
"nodebb-theme-lavender": "7.1.19",
"nodebb-theme-peace": "2.2.49",
"nodebb-theme-persona": "14.1.18",
"nodebb-widget-essentials": "7.0.40",
"nodebb-widget-essentials": "7.0.41",
"nodemailer": "7.0.11",
"nprogress": "0.2.0",
"passport": "0.7.0",
@@ -129,7 +129,7 @@
"rss": "1.2.2",
"rtlcss": "4.3.0",
"sanitize-html": "2.17.0",
"sass": "1.94.2",
"sass": "1.96.0",
"satori": "0.18.3",
"sbd": "^1.0.19",
"semver": "7.7.3",
@@ -141,7 +141,7 @@
"@socket.io/redis-adapter": "8.3.0",
"sortablejs": "1.15.6",
"spdx-license-list": "6.10.0",
"terser-webpack-plugin": "5.3.15",
"terser-webpack-plugin": "5.3.16",
"textcomplete": "0.18.2",
"textcomplete.contenteditable": "0.1.1",
"timeago": "1.6.7",
@@ -152,7 +152,7 @@
"validator": "13.15.23",
"webpack": "5.103.0",
"webpack-merge": "6.0.1",
"winston": "3.18.3",
"winston": "3.19.0",
"workerpool": "10.0.1",
"xml": "1.0.1",
"xregexp": "5.1.2",
@@ -164,23 +164,23 @@
"@commitlint/cli": "20.2.0",
"@commitlint/config-angular": "20.2.0",
"coveralls": "3.1.1",
"@eslint/js": "9.39.1",
"@eslint/js": "9.39.2",
"@stylistic/eslint-plugin": "5.6.1",
"eslint-config-nodebb": "1.1.11",
"eslint-plugin-import": "2.32.0",
"grunt": "1.6.1",
"grunt-contrib-watch": "1.1.0",
"husky": "8.0.3",
"jsdom": "27.2.0",
"husky": "9.1.7",
"jsdom": "27.3.0",
"lint-staged": "16.2.7",
"mocha": "11.7.5",
"mocha-lcov-reporter": "1.3.0",
"mockdate": "3.0.5",
"nyc": "17.1.0",
"smtp-server": "3.16.1"
"smtp-server": "3.17.1"
},
"optionalDependencies": {
"sass-embedded": "1.93.3"
"sass-embedded": "1.96.0"
},
"resolutions": {
"*/jquery": "3.7.1"

View File

@@ -19,9 +19,7 @@ delete:
description: a valid UNIX timestamp
example: 1611850000000
responses:
"200":
'200':
description: Post diff successfully deleted
content:
application/json:
schema:
$ref: ../diffs.yaml#/get/responses/200/content
$ref: ../diffs.yaml#/get/responses/200/content

View File

@@ -102,7 +102,7 @@ define('forum/account/settings', [
if (languageChanged && parseInt(app.user.uid, 10) === parseInt(ajaxify.data.theirid, 10)) {
window.location.reload();
}
});
}).catch(alerts.error);
}
function toggleCustomRoute() {

View File

@@ -352,6 +352,26 @@ inbox.like = async (req) => {
socketHelpers.upvote(result, 'notifications:upvoted-your-post-in');
};
inbox.dislike = async (req) => {
const { actor, object } = req.body;
const { type, id } = await activitypub.helpers.resolveLocalId(object.id);
if (type !== 'post' || !(await posts.exists(id))) {
return reject('Dislike', object, actor);
}
const allowed = await privileges.posts.can('posts:downvote', id, activitypub._constants.uid);
if (!allowed) {
activitypub.helpers.log(`[activitypub/inbox.like] ${id} not allowed to be downvoted.`);
return reject('Dislike', object, actor);
}
activitypub.helpers.log(`[activitypub/inbox/dislike] id ${id} via ${actor}`);
await posts.downvote(id, actor);
await activitypub.feps.announce(object.id, req.body);
};
inbox.announce = async (req) => {
let { actor, object, published, to, cc } = req.body;
activitypub.helpers.log(`[activitypub/inbox/announce] Parsing Announce(${object.type}) from ${actor}`);

View File

@@ -277,6 +277,32 @@ Out.like.note = enabledCheck(async (uid, pid) => {
]);
});
Out.dislike = {};
Out.dislike.note = enabledCheck(async (uid, pid) => {
const payload = {
id: `${nconf.get('url')}/uid/${uid}#activity/dislike/${encodeURIComponent(pid)}`,
type: 'Dislike',
actor: `${nconf.get('url')}/uid/${uid}`,
object: utils.isNumber(pid) ? `${nconf.get('url')}/post/${pid}` : pid,
};
if (!activitypub.helpers.isUri(pid)) { // only 1b12 announce for local likes
await activitypub.feps.announce(pid, payload);
return;
}
const recipient = await posts.getPostField(pid, 'uid');
if (!activitypub.helpers.isUri(recipient)) {
return;
}
await Promise.all([
activitypub.send('uid', uid, [recipient], payload),
activitypub.feps.announce(pid, payload),
]);
});
Out.announce = {};
Out.announce.topic = enabledCheck(async (tid) => {

View File

@@ -147,14 +147,34 @@ async function executeCommand(caller, command, eventName, notification, data) {
websockets.in(`uid_${caller.uid}`).emit(`posts.${command}`, result);
websockets.in(data.room_id).emit(`event:${eventName}`, result);
}
if (result && command === 'upvote') {
socketHelpers.upvote(result, notification);
await activitypub.out.like.note(caller.uid, data.pid);
} else if (result && notification) {
socketHelpers.sendNotificationToPostOwner(data.pid, caller.uid, command, notification);
} else if (result && command === 'unvote') {
socketHelpers.rescindUpvoteNotification(data.pid, caller.uid);
await activitypub.out.undo.like(caller.uid, data.pid);
if (result) {
switch (command) {
case 'upvote': {
socketHelpers.upvote(result, notification);
await activitypub.out.like.note(caller.uid, data.pid);
break;
}
case 'downvote': {
await activitypub.out.dislike.note(caller.uid, data.pid);
break;
}
case 'unvote': {
socketHelpers.rescindUpvoteNotification(data.pid, caller.uid);
await activitypub.out.undo.like(caller.uid, data.pid);
break;
}
default: {
if (notification) {
socketHelpers.sendNotificationToPostOwner(data.pid, caller.uid, command, notification);
}
break;
}
}
}
return result;
}

View File

@@ -177,16 +177,18 @@ module.exports = function (Posts) {
}
const now = Date.now();
if (type === 'upvote' && !unvote) {
await db.sortedSetAdd(`uid:${uid}:upvote`, now, pid);
} else {
await db.sortedSetRemove(`uid:${uid}:upvote`, pid);
}
if (utils.isNumber(uid)) {
if (type === 'upvote' && !unvote) {
await db.sortedSetAdd(`uid:${uid}:upvote`, now, pid);
} else {
await db.sortedSetRemove(`uid:${uid}:upvote`, pid);
}
if (type === 'upvote' || unvote) {
await db.sortedSetRemove(`uid:${uid}:downvote`, pid);
} else {
await db.sortedSetAdd(`uid:${uid}:downvote`, now, pid);
if (type === 'upvote' || unvote) {
await db.sortedSetRemove(`uid:${uid}:downvote`, pid);
} else {
await db.sortedSetAdd(`uid:${uid}:downvote`, now, pid);
}
}
const postData = await Posts.getPostFields(pid, ['pid', 'uid', 'tid']);

View File

@@ -290,7 +290,7 @@ module.exports = function (Topics) {
};
Topics.markAsRead = async function (tids, uid) {
if (!Array.isArray(tids) || !tids.length) {
if (!Array.isArray(tids) || !tids.length || !utils.isNumber(uid)) {
return false;
}

View File

@@ -0,0 +1,24 @@
'use strict';
const db = require('../../database');
const batch = require('../../batch');
module.exports = {
name: 'Remove extraneous upvote and tids_read data for remote users',
timestamp: Date.UTC(2025, 11, 11),
method: async function () {
const { progress } = this;
await batch.processSortedSet('usersRemote:lastCrawled', async (uids) => {
const readKeys = uids.map(uid => `uid:${uid}:tids_read`);
const voteKeys = uids.map(uid => `uid:${uid}:upvote`);
const combined = readKeys.concat(voteKeys);
await db.deleteAll(combined);
progress.incr(uids.length);
}, {
batch: 500,
progress,
});
},
};

View File

@@ -432,6 +432,7 @@ describe('Notes', () => {
describe('Create', () => {
let uid;
let cid;
before(async () => {
uid = await user.create({ username: utils.generateUUID() });
@@ -451,6 +452,17 @@ describe('Notes', () => {
assert.strictEqual(cid, -1);
});
it('should not append to the tids_read sorted set', async () => {
const { note, id } = helpers.mocks.note();
const { activity } = helpers.mocks.create(note);
await db.sortedSetAdd(`followersRemote:${note.attributedTo}`, Date.now(), uid);
await activitypub.inbox.create({ body: activity });
const exists = await db.exists(`uid:${note.attributedTo}:tids_read`);
assert(!exists);
});
it('should create a new topic in a remote category if addressed (category same-origin)', async () => {
const { id: remoteCid } = helpers.mocks.group();
const { note, id } = helpers.mocks.note({
@@ -467,40 +479,63 @@ describe('Notes', () => {
});
it('should create a new topic in cid -1 if a non-same origin remote category is addressed', async function () {
this.timeout(30000);
const start = Date.now();
const { id: remoteCid } = helpers.mocks.group({
id: `https://example.com/${utils.generateUUID()}`,
});
console.log('1', Date.now() - start);
const { note, id } = helpers.mocks.note({
audience: [remoteCid],
});
console.log('2', Date.now() - start);
const { activity } = helpers.mocks.create(note);
console.log('3', Date.now() - start);
try {
await activitypub.inbox.create({ body: activity });
} catch (err) {
console.log('error in test', err.stack);
assert(false);
}
console.log('4', Date.now() - start);
assert(await posts.exists(id));
console.log('5', Date.now() - start);
const cid = await posts.getCidByPid(id);
console.log('6', Date.now() - start);
assert.strictEqual(cid, -1);
});
});
describe('(Like)', () => {
let pid;
let voterUid;
before(async () => {
({ cid } = await categories.create({ name: utils.generateUUID() }));
const { postData } = await topics.post({
uid,
cid,
title: utils.generateUUID(),
content: utils.generateUUID(),
});
pid = postData.pid;
const object = await activitypub.mocks.notes.public(postData);
const { activity } = helpers.mocks.like({ object });
voterUid = activity.actor;
await activitypub.inbox.like({ body: activity });
});
it('should increment a like for the post', async () => {
const voted = await posts.hasVoted(pid, voterUid);
const count = await posts.getPostField(pid, 'upvotes');
assert(voted);
assert.strictEqual(count, 1);
});
it('should not append to the uid upvotes zset', async () => {
const exists = await db.exists(`uid:${voterUid}:upvote`);
assert(!exists);
});
});
});
describe('Announce', () => {
let cid;
before(async () => {
({ cid } = await categories.create({ name: utils.generateUUID().slice(0, 8) }));
({ cid } = await categories.create({ name: utils.generateUUID() }));
});
describe('(Create)', () => {