mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: move AP send logging earlier
This commit is contained in:
@@ -337,11 +337,6 @@ async function sendMessage(uri, id, type, payload, attempts = 1) {
|
|||||||
const keyData = await ActivityPub.getPrivateKey(type, id);
|
const keyData = await ActivityPub.getPrivateKey(type, id);
|
||||||
const headers = await ActivityPub.sign(keyData, uri, payload);
|
const headers = await ActivityPub.sign(keyData, uri, payload);
|
||||||
|
|
||||||
ActivityPub.helpers.log(`[activitypub/send] ${uri}`);
|
|
||||||
if (process.env.hasOwnProperty('CI')) {
|
|
||||||
ActivityPub._sent.set(payload.id, payload);
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { response, body } = await request.post(uri, {
|
const { response, body } = await request.post(uri, {
|
||||||
headers: {
|
headers: {
|
||||||
@@ -381,6 +376,11 @@ ActivityPub.send = async (type, id, targets, payload) => {
|
|||||||
return ActivityPub.helpers.log('[activitypub/send] Federation not enabled; not sending.');
|
return ActivityPub.helpers.log('[activitypub/send] Federation not enabled; not sending.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ActivityPub.helpers.log(`[activitypub/send] ${payload.id}`);
|
||||||
|
if (process.env.hasOwnProperty('CI')) {
|
||||||
|
ActivityPub._sent.set(payload.id, payload);
|
||||||
|
}
|
||||||
|
|
||||||
if (!Array.isArray(targets)) {
|
if (!Array.isArray(targets)) {
|
||||||
targets = [targets];
|
targets = [targets];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ describe('ActivityPub integration', () => {
|
|||||||
const uid = await user.create({ username: uuid });
|
const uid = await user.create({ username: uuid });
|
||||||
await activitypub.send('uid', 0, [`https://localhost/uid/${uid}`], { id: `${nconf.get('url')}/activity/${uuid}`, foo: 'bar' });
|
await activitypub.send('uid', 0, [`https://localhost/uid/${uid}`], { id: `${nconf.get('url')}/activity/${uuid}`, foo: 'bar' });
|
||||||
|
|
||||||
assert(activitypub._sent.has(`https://localhost/activity/${uuid}`));
|
assert(activitypub._sent.has(`${nconf.get('url')}/activity/${uuid}`));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -59,9 +59,7 @@ describe('FEPs', () => {
|
|||||||
cid,
|
cid,
|
||||||
});
|
});
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
assert.strictEqual(activitypub._sent.size, 1);
|
assert.strictEqual(activitypub._sent.size, 1);
|
||||||
}, 250);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user