Skip to content

Node.js based forum software built for the modern web

fix: title generation error when empty postdata content was passed in to generateTitle

Julian Lam4a0e4ffd655d
diff --git a/src/activitypub/inbox.js b/src/activitypub/inbox.js
index f6bef4e957..934e9ce58f 100644
--- a/src/activitypub/inbox.js
+++ b/src/activitypub/inbox.js
@@ -185,7 +185,7 @@ inbox.update = async (req) => {
const tid = await posts.getPostField(object.id, 'tid');
const { generatedTitle } = await topics.getTopicFields(tid, ['generatedTitle']);
if (generatedTitle && (!postData.title || !postData.title.trim())) {
- const newTitle = activitypub.helpers.generateTitle(postData.content);
+ const newTitle = activitypub.helpers.generateTitle(postData.sourceContent || postData.content);
await topics.setTopicField(tid, 'title', newTitle);
await topics.setTopicField(tid, 'slug', `${tid}/${slugify(newTitle) || 'topic'}`);
}