mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-27 09:01:23 +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(
|
const post = (await posts.getPostSummaryByPids(
|
||||||
[resolvedId],
|
[resolvedId],
|
||||||
activitypub._constants.uid,
|
activitypub._constants.uid,
|
||||||
{ stripTags: false }
|
{
|
||||||
|
stripTags: false,
|
||||||
|
extraFields: ['edited'],
|
||||||
|
}
|
||||||
)).pop();
|
)).pop();
|
||||||
if (!post) {
|
if (!post) {
|
||||||
throw new Error('[[error:activitypub.invalid-id]]');
|
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
|
// todo: post visibility
|
||||||
const to = new Set([activitypub._constants.publicAddress]);
|
const to = new Set([activitypub._constants.publicAddress]);
|
||||||
@@ -420,6 +421,7 @@ Mocks.note = async (post) => {
|
|||||||
cc: Array.from(cc),
|
cc: Array.from(cc),
|
||||||
inReplyTo,
|
inReplyTo,
|
||||||
published,
|
published,
|
||||||
|
updated,
|
||||||
url: id,
|
url: id,
|
||||||
attributedTo: `${nconf.get('url')}/uid/${post.user.uid}`,
|
attributedTo: `${nconf.get('url')}/uid/${post.user.uid}`,
|
||||||
context: `${nconf.get('url')}/topic/${post.topic.tid}`,
|
context: `${nconf.get('url')}/topic/${post.topic.tid}`,
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ async function deleteOrRestore(caller, data, params) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Explicitly non-awaited
|
// 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 });
|
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.
|
// 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.
|
// 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 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) {
|
if (!allowed || !post) {
|
||||||
return res.sendStatus(404);
|
return res.sendStatus(404);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user