chore: move isPureRenote to misc

This commit is contained in:
anatawa12 2023-10-30 10:43:20 +09:00
parent c2505b12d6
commit bfa6d7b525
No known key found for this signature in database
GPG Key ID: 9CA909848B8E4EA6
2 changed files with 11 additions and 9 deletions

View File

@ -0,0 +1,10 @@
import type { MiNote } from '@/models/Note.js';
export function isPureRenote(note: MiNote): boolean {
if (!note.renoteId) return false;
if (note.text) return false; // it's quoted with text
if (note.fileIds.length !== 0) return false; // it's quoted with files
if (note.hasPoll) return false; // it's quoted with poll
return true;
}

View File

@ -17,6 +17,7 @@ import { NoteEntityService } from '@/core/entities/NoteEntityService.js';
import { NoteCreateService } from '@/core/NoteCreateService.js';
import { DI } from '@/di-symbols.js';
import { ApiError } from '../../error.js';
import { isPureRenote } from '@/misc/is-pure-renote.js';
export const meta = {
tags: ['notes'],
@ -214,15 +215,6 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
}
}
function isPureRenote(note: MiNote): boolean {
if (!note.renoteId) return false;
if (note.text) return false; // it's quoted with text
if (note.fileIds.length !== 0) return false; // it's quoted with files
if (note.hasPoll) return false; // it's quoted with poll
return true;
}
let renote: MiNote | null = null;
if (ps.renoteId != null) {
// Fetch renote to note