mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: revert introduction of toPid into post intFields, manually cast toPid as int in getPostSummaryByPids if present and numeric
This commit is contained in:
@@ -8,7 +8,7 @@ const activitypub = require('../activitypub');
|
|||||||
const utils = require('../utils');
|
const utils = require('../utils');
|
||||||
|
|
||||||
const intFields = [
|
const intFields = [
|
||||||
'uid', 'pid', 'tid', 'toPid', 'deleted', 'timestamp',
|
'uid', 'pid', 'tid', 'deleted', 'timestamp',
|
||||||
'upvotes', 'downvotes', 'deleterUid', 'edited',
|
'upvotes', 'downvotes', 'deleterUid', 'edited',
|
||||||
'replies', 'bookmarks',
|
'replies', 'bookmarks',
|
||||||
];
|
];
|
||||||
@@ -62,7 +62,7 @@ function modifyPost(post, fields) {
|
|||||||
const _intFields = [...intFields];
|
const _intFields = [...intFields];
|
||||||
|
|
||||||
if (post) {
|
if (post) {
|
||||||
['pid', 'uid', 'tid', 'toPid'].forEach((prop) => {
|
['pid', 'uid', 'tid'].forEach((prop) => {
|
||||||
if (
|
if (
|
||||||
post.hasOwnProperty(prop) &&
|
post.hasOwnProperty(prop) &&
|
||||||
(activitypub.helpers.isUri(post[prop]) || validator.isUUID(String(post[prop])))
|
(activitypub.helpers.isUri(post[prop]) || validator.isUUID(String(post[prop])))
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ module.exports = function (Posts) {
|
|||||||
if (!uidToUser.hasOwnProperty(post.uid)) {
|
if (!uidToUser.hasOwnProperty(post.uid)) {
|
||||||
post.uid = 0;
|
post.uid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// toPid is nullable so it is casted separately
|
||||||
|
post.toPid = utils.isNumber(post.toPid) ? parseInt(post.toPid, 10) : post.toPid;
|
||||||
|
|
||||||
post.user = uidToUser[post.uid];
|
post.user = uidToUser[post.uid];
|
||||||
Posts.overrideGuestHandle(post, post.handle);
|
Posts.overrideGuestHandle(post, post.handle);
|
||||||
post.handle = undefined;
|
post.handle = undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user