fix: missing actor on some local activities when federating out

This commit is contained in:
Julian Lam
2025-02-07 08:20:27 -05:00
parent 123e16358d
commit 040584f035

View File

@@ -168,6 +168,7 @@ activitypubApi.create.privateNote = enabledCheck(async (caller, { messageObj })
const payload = { const payload = {
id: `${object.id}#activity/create/${Date.now()}`, id: `${object.id}#activity/create/${Date.now()}`,
type: 'Create', type: 'Create',
actor: object.attributedTo,
to: object.to, to: object.to,
object, object,
}; };
@@ -186,6 +187,7 @@ activitypubApi.update.profile = enabledCheck(async (caller, { uid }) => {
await activitypub.send('uid', caller.uid, targets, { await activitypub.send('uid', caller.uid, targets, {
id: `${object.id}#activity/update/${Date.now()}`, id: `${object.id}#activity/update/${Date.now()}`,
type: 'Update', type: 'Update',
actor: object.id,
to: [activitypub._constants.publicAddress], to: [activitypub._constants.publicAddress],
cc: [], cc: [],
object, object,
@@ -201,6 +203,7 @@ activitypubApi.update.category = enabledCheck(async (caller, { cid }) => {
await activitypub.send('cid', cid, targets, { await activitypub.send('cid', cid, targets, {
id: `${object.id}#activity/update/${Date.now()}`, id: `${object.id}#activity/update/${Date.now()}`,
type: 'Update', type: 'Update',
actor: object.id,
to: [activitypub._constants.publicAddress], to: [activitypub._constants.publicAddress],
cc: [], cc: [],
object, object,
@@ -227,6 +230,7 @@ activitypubApi.update.note = enabledCheck(async (caller, { post }) => {
const payload = { const payload = {
id: `${object.id}#activity/update/${post.edited || Date.now()}`, id: `${object.id}#activity/update/${post.edited || Date.now()}`,
type: 'Update', type: 'Update',
actor: object.attributedTo,
to, to,
cc, cc,
object, object,
@@ -251,6 +255,7 @@ activitypubApi.update.privateNote = enabledCheck(async (caller, { messageObj })
const payload = { const payload = {
id: `${object.id}#activity/create/${Date.now()}`, id: `${object.id}#activity/create/${Date.now()}`,
type: 'Update', type: 'Update',
actor: object.attributedTo,
to, to,
object, object,
}; };
@@ -280,6 +285,7 @@ activitypubApi.delete.note = enabledCheck(async (caller, { pid }) => {
const payload = { const payload = {
id: `${id}#activity/delete/${Date.now()}`, id: `${id}#activity/delete/${Date.now()}`,
type: 'Delete', type: 'Delete',
actor: object.attributedTo,
to, to,
cc, cc,
object: id, object: id,
@@ -334,6 +340,7 @@ activitypubApi.announce.note = enabledCheck(async (caller, { tid }) => {
await activitypub.send('uid', caller.uid, Array.from(targets), { await activitypub.send('uid', caller.uid, Array.from(targets), {
id: `${nconf.get('url')}/post/${encodeURIComponent(pid)}#activity/announce/${Date.now()}`, id: `${nconf.get('url')}/post/${encodeURIComponent(pid)}#activity/announce/${Date.now()}`,
type: 'Announce', type: 'Announce',
actor: `${nconf.get('url')}/uid/${caller.uid}`,
to, to,
cc, cc,
object: pid, object: pid,
@@ -380,6 +387,7 @@ activitypubApi.flag = enabledCheck(async (caller, flag) => {
await activitypub.send('uid', caller.uid, reportedIds, { await activitypub.send('uid', caller.uid, reportedIds, {
id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/flag/${caller.uid}`, id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/flag/${caller.uid}`,
type: 'Flag', type: 'Flag',
actor: `${nconf.get('url')}/uid/${caller.uid}`,
object: reportedIds, object: reportedIds,
content: reason, content: reason,
}); });
@@ -426,6 +434,7 @@ activitypubApi.undo.flag = enabledCheck(async (caller, flag) => {
await activitypub.send('uid', caller.uid, reportedIds, { await activitypub.send('uid', caller.uid, reportedIds, {
id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/undo:flag/${caller.uid}/${Date.now()}`, id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/undo:flag/${caller.uid}/${Date.now()}`,
type: 'Undo', type: 'Undo',
actor: `${nconf.get('url')}/uid/${caller.uid}`,
object: { object: {
id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/flag/${caller.uid}`, id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/flag/${caller.uid}`,
actor: `${nconf.get('url')}/uid/${caller.uid}`, actor: `${nconf.get('url')}/uid/${caller.uid}`,