mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-25 16:59:52 +01:00
feat: user crossposts federate as:Announce
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
const db = require('../../database');
|
const db = require('../../database');
|
||||||
const api = require('../../api');
|
const api = require('../../api');
|
||||||
const topics = require('../../topics');
|
const topics = require('../../topics');
|
||||||
|
const activitypub = require('../../activitypub');
|
||||||
|
|
||||||
const helpers = require('../helpers');
|
const helpers = require('../helpers');
|
||||||
const middleware = require('../../middleware');
|
const middleware = require('../../middleware');
|
||||||
@@ -222,6 +223,7 @@ Topics.getCrossposts = async (req, res) => {
|
|||||||
Topics.crosspost = async (req, res) => {
|
Topics.crosspost = async (req, res) => {
|
||||||
const { cid } = req.body;
|
const { cid } = req.body;
|
||||||
const crossposts = await topics.crossposts.add(req.params.tid, cid, req.uid);
|
const crossposts = await topics.crossposts.add(req.params.tid, cid, req.uid);
|
||||||
|
await activitypub.out.announce.topic(req.params.tid, req.uid);
|
||||||
|
|
||||||
helpers.formatApiResponse(200, res, { crossposts });
|
helpers.formatApiResponse(200, res, { crossposts });
|
||||||
};
|
};
|
||||||
@@ -229,6 +231,7 @@ Topics.crosspost = async (req, res) => {
|
|||||||
Topics.uncrosspost = async (req, res) => {
|
Topics.uncrosspost = async (req, res) => {
|
||||||
const { cid } = req.body;
|
const { cid } = req.body;
|
||||||
const crossposts = await topics.crossposts.remove(req.params.tid, cid, req.uid);
|
const crossposts = await topics.crossposts.remove(req.params.tid, cid, req.uid);
|
||||||
|
await activitypub.out.undo.announce('uid', req.uid, req.parms.tid);
|
||||||
|
|
||||||
helpers.formatApiResponse(200, res, { crossposts });
|
helpers.formatApiResponse(200, res, { crossposts });
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user