feat: activitypub response to note retrieval via pid

This commit is contained in:
Julian Lam
2024-01-25 16:26:39 -05:00
parent 0b3ca8e366
commit 6b517252b9
5 changed files with 34 additions and 19 deletions

View File

@@ -6,7 +6,7 @@ const activitypub = require('../activitypub');
const utils = require('../utils');
const intFields = [
'uid', 'pid', 'tid', 'deleted', 'timestamp',
'uid', 'pid', 'tid', 'toPid', 'deleted', 'timestamp',
'upvotes', 'downvotes', 'deleterUid', 'edited',
'replies', 'bookmarks',
];
@@ -63,6 +63,9 @@ function modifyPost(post, fields) {
intFields.splice(intFields.indexOf('uid'), 1);
intFields.splice(intFields.indexOf('tid'), 1);
}
if (activitypub.helpers.isUri(post.toPid)) {
intFields.splice(intFields.indexOf('toPid'), 1);
}
db.parseIntFields(post, intFields, fields);
if (post.hasOwnProperty('upvotes') && post.hasOwnProperty('downvotes')) {
post.votes = post.upvotes - post.downvotes;