mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 10:35:55 +01:00
feat: execute 1b12 rebroadcast logic on all tids even if not posted to a local cid
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
const nconf = require('nconf');
|
const nconf = require('nconf');
|
||||||
|
|
||||||
const posts = require('../posts');
|
const posts = require('../posts');
|
||||||
|
const topics = require('../topics');
|
||||||
const utils = require('../utils');
|
const utils = require('../utils');
|
||||||
|
|
||||||
const activitypub = module.parent.exports;
|
const activitypub = module.parent.exports;
|
||||||
@@ -13,8 +14,16 @@ Feps.announce = async function announce(id, activity) {
|
|||||||
if (String(id).startsWith(nconf.get('url'))) {
|
if (String(id).startsWith(nconf.get('url'))) {
|
||||||
({ id: localId } = await activitypub.helpers.resolveLocalId(id));
|
({ id: localId } = await activitypub.helpers.resolveLocalId(id));
|
||||||
}
|
}
|
||||||
const cid = await posts.getCidByPid(localId || id);
|
|
||||||
if (cid === -1 || !utils.isNumber(cid)) { // local cids only
|
/**
|
||||||
|
* Re-broadcasting occurs on
|
||||||
|
* - local cids (for all tids), and
|
||||||
|
* - local tids (posted to remote cids) only
|
||||||
|
*/
|
||||||
|
const tid = await posts.getPostField(localId || id, 'tid');
|
||||||
|
const cid = await topics.getTopicField(tid, 'cid');
|
||||||
|
const shouldAnnounce = (utils.isNumber(cid) && cid > 0) || utils.isNumber(tid);
|
||||||
|
if (!shouldAnnounce) { // inverse conditionals can kiss my ass.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user