fix(activitypub): add Like vocab import in activity dispatcher patch

On fresh installs where the old wrong patch was never applied, Like was
absent from the @fedify/fedify/vocab imports, causing a ReferenceError
at startup. The dispatcher patch now adds Like to the import block if
missing, making it self-contained and install-order independent.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Sven
2026-03-21 09:05:34 +01:00
parent 99d2e38066
commit 535e6f5e9c

View File

@@ -93,6 +93,11 @@ for (const filePath of candidates) {
continue;
}
// Ensure Like is imported from @fedify/fedify/vocab (may be absent on fresh installs)
if (!source.includes(" Like,")) {
source = source.replace(" Note,", " Like,\n Note,");
}
source = source.replace(OLD_SNIPPET, NEW_SNIPPET);
await writeFile(filePath, source, "utf8");
patched += 1;