mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: handle resolved objects in flag
This commit is contained in:
@@ -360,15 +360,14 @@ inbox.undo = async (req) => {
|
||||
inbox.flag = async (req) => {
|
||||
const { actor, object, content } = req.body;
|
||||
const objects = Array.isArray(object) ? object : [object];
|
||||
const subjects = await Promise.all(objects.map(helpers.resolveLocalId));
|
||||
|
||||
// Check if the actor is valid
|
||||
if (!await activitypub.actors.assert(actor)) {
|
||||
return reject('Flag', objects, actor);
|
||||
}
|
||||
|
||||
await Promise.all(subjects.map(async (subject, index) => {
|
||||
const { type, id } = subject;
|
||||
await Promise.all(objects.map(async (subject, index) => {
|
||||
const { type, id } = await activitypub.helpers.resolveLocalId(subject.id);
|
||||
try {
|
||||
await flags.create(type, id, actor, content);
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user