mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36: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 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 {
|
||||
const { response, body } = await request.post(uri, {
|
||||
headers: {
|
||||
@@ -381,6 +376,11 @@ ActivityPub.send = async (type, id, targets, payload) => {
|
||||
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)) {
|
||||
targets = [targets];
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('ActivityPub integration', () => {
|
||||
const uid = await user.create({ username: uuid });
|
||||
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,
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
assert.strictEqual(activitypub._sent.size, 1);
|
||||
}, 250);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user