fix replacements crashing on delivering poll votes
Some checks failed
/ test-build (push) Has been cancelled

This commit is contained in:
mia 2024-11-05 16:29:52 -07:00 committed by limepotato
parent 4bc55eb6c9
commit ebe2ff0e21

View file

@ -36,24 +36,26 @@ export default async (job: Bull.Job<DeliverJobData>) => {
logger.debug(`delivering ${latest}`);
}
let i = undefined;
if (
["Create", "Update"].includes(job.data.content.type)
&& job.data.content.object.type === "Note"
) {
const obj = job.data.content.object;
const patchSrcContent = shouldPatchText(obj.source.content);
if (patchSrcContent) {
i = await registerOrFetchInstanceDoc(host);
if (shouldPatchText(obj.content))
obj.content = patchText(obj.content, i);
if (shouldPatchText(obj._misskey_content))
obj._misskey_content = patchText(obj._misskey_content, i);
if (patchSrcContent)
obj.source.content = patchText(obj.source.content, i);
}
}
let i = undefined;
if (
["Create", "Update"].includes(job.data.content.type)
&& job.data.content.object.type === "Note"
&& job.data.content.object.content
) {
const obj = job.data.content.object;
const patchSrcContent = shouldPatchText(obj.source.content);
if (patchSrcContent) {
i = await registerOrFetchInstanceDoc(host);
if (shouldPatchText(obj.content))
obj.content = patchText(obj.content, i);
if (shouldPatchText(obj._misskey_content))
obj._misskey_content = patchText(obj._misskey_content, i);
if (patchSrcContent)
obj.source.content = patchText(obj.source.content, i);
}
}
await request(job.data.user, job.data.to, job.data.content);