Node.js based forum software built for the modern web
fix: `inReplyTo` for private notes so that refer to the immediately previous message if not explicitly defined
Julian Lamf4a02d9c6222
diff --git a/src/activitypub/mocks.js b/src/activitypub/mocks.jsindex 5d827d35a4..7fc0958767 100644--- a/src/activitypub/mocks.js+++ b/src/activitypub/mocks.js@@ -6,6 +6,7 @@ const path = require('path');const validator = require('validator');const sanitize = require('sanitize-html');+const db = require('../database');const user = require('../user');const categories = require('../categories');const posts = require('../posts');@@ -482,6 +483,14 @@ Mocks.notes.private = async ({ messageObj }) => {`${nconf.get('url')}/api/v3/chats/${messageObj.roomId}/messages/${messageObj.toMid}` :messageObj.toMid;}+ if (!inReplyTo) {+ // Get immediately preceding message+ const index = await db.sortedSetRank(`chat:room:${messageObj.roomId}:mids`, messageObj.mid);+ const previousMid = await db.getSortedSetRange(`chat:room:${messageObj.roomId}:mids`, index - 1, index - 1);+ inReplyTo = utils.isNumber(previousMid) ?+ `${nconf.get('url')}/api/v3/chats/${messageObj.roomId}/messages/${previousMid}` :+ messageObj.toMid;+ }const object = {'@context': 'https://www.w3.org/ns/activitystreams',