fix: we can renote pure renote

This commit is contained in:
anatawa12 2023-10-28 17:56:37 +09:00
parent 688e1fdb77
commit f6d015d93e
No known key found for this signature in database
GPG Key ID: 9CA909848B8E4EA6
1 changed files with 11 additions and 2 deletions

View File

@ -215,7 +215,17 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
function isPureRenote(note: MiNote): boolean {
return !!(note.renoteId && !note.text && !note.fileIds && !note.hasPoll);
console.log("isPureRenote", note);
if (!note.renoteId) return false;
console.log("isPureRenote: no renoteId");
if (note.text) return false; // it's quoted with text
console.log("isPureRenote: not quoted with text");
if (note.fileIds.length !== 0) return false; // it's quoted with files
console.log("isPureRenote: not quoted with file");
if (note.hasPoll) return false; // it's quoted with poll
console.log("isPureRenote: not quoted with poll");
return true;
}
let renote: MiNote | null = null;
@ -223,7 +233,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
// Fetch renote to note
renote = await this.notesRepository.findOneBy({ id: ps.renoteId });
console.log("renote", renote);
if (renote == null) {
throw new ApiError(meta.errors.noSuchRenoteTarget);
} else if (isPureRenote(renote)) {