mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 11:35:55 +01:00
fix: explicitly set updated property when federating notes out
This commit is contained in:
@@ -256,7 +256,10 @@ Helpers.resolveObjects = async (ids) => {
|
||||
const post = (await posts.getPostSummaryByPids(
|
||||
[resolvedId],
|
||||
activitypub._constants.uid,
|
||||
{ stripTags: false }
|
||||
{
|
||||
stripTags: false,
|
||||
extraFields: ['edited'],
|
||||
}
|
||||
)).pop();
|
||||
if (!post) {
|
||||
throw new Error('[[error:activitypub.invalid-id]]');
|
||||
|
||||
@@ -277,7 +277,8 @@ Mocks.note = async (post) => {
|
||||
});
|
||||
}
|
||||
|
||||
const published = new Date(parseInt(post.timestamp, 10)).toISOString();
|
||||
const published = post.timestampISO;
|
||||
const updated = post.edited ? post.editedISO : null;
|
||||
|
||||
// todo: post visibility
|
||||
const to = new Set([activitypub._constants.publicAddress]);
|
||||
@@ -420,6 +421,7 @@ Mocks.note = async (post) => {
|
||||
cc: Array.from(cc),
|
||||
inReplyTo,
|
||||
published,
|
||||
updated,
|
||||
url: id,
|
||||
attributedTo: `${nconf.get('url')}/uid/${post.user.uid}`,
|
||||
context: `${nconf.get('url')}/topic/${post.topic.tid}`,
|
||||
|
||||
@@ -207,7 +207,7 @@ async function deleteOrRestore(caller, data, params) {
|
||||
});
|
||||
|
||||
// Explicitly non-awaited
|
||||
posts.getPostSummaryByPids([data.pid], caller.uid, {}).then(([post]) => {
|
||||
posts.getPostSummaryByPids([data.pid], caller.uid, { extraFields: ['edited'] }).then(([post]) => {
|
||||
require('.').activitypub.update.note(caller, { post });
|
||||
});
|
||||
}
|
||||
|
||||
@@ -58,7 +58,10 @@ Actors.note = async function (req, res) {
|
||||
// technically a note isn't an actor, but it is here purely for organizational purposes.
|
||||
// but also, wouldn't it be wild if you could follow a note? lol.
|
||||
const allowed = utils.isNumber(req.params.pid) && await privileges.posts.can('topics:read', req.params.pid, activitypub._constants.uid);
|
||||
const post = (await posts.getPostSummaryByPids([req.params.pid], req.uid, { stripTags: false })).pop();
|
||||
const post = (await posts.getPostSummaryByPids([req.params.pid], req.uid, {
|
||||
stripTags: false,
|
||||
extraFields: ['edited'],
|
||||
})).pop();
|
||||
if (!allowed || !post) {
|
||||
return res.sendStatus(404);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user