Skip to content

Node.js based forum software built for the modern web

Proactively assert unknown remote pids on like and dislike intent

Julian Lam7f585abe1cae
diff --git a/src/controllers/intents.js b/src/controllers/intents.js
index 08a02289b7..471a699482 100644
--- a/src/controllers/intents.js
+++ b/src/controllers/intents.js
@@ -1,6 +1,5 @@
'use strict';
-const nconf = require('nconf');
const posts = require('../posts');
const categories = require('../categories');
const user = require('../user');
@@ -8,10 +7,6 @@ const helpers = require('./helpers');
const activitypub = require('../activitypub');
const utils = require('../utils');
-const config = {
- url: nconf.get('url'),
-};
-
const Intents = module.exports;
Intents.create = async (req, res, next) => {
@@ -95,7 +90,12 @@ Intents.create = async (req, res, next) => {
if (exists) {
payload.pid = pid;
} else {
- // todo: assert the post and then set payload.pid
+ const assertion = await activitypub.notes.assert(req.uid, pid);
+ if (!assertion) {
+ return next();
+ }
+
+ payload.pid = pid;
}
break;
}