misskey/packages/frontend/src/scripts/collapsed.ts
かっこかり 80b4272c57
fix(frontend): fix lint (#15906)
(cherry picked from commit f8b0863b8edf18dac9188a93a52c4d149eabb0e9)

* fix(frontend): attempt to fix lint

* fix lint
2025-05-01 21:29:39 +09:00

35 lines
672 B
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as Misskey from 'misskey-js';
export function shouldCollapsed(note: Misskey.entities.Note, urls: string[]): boolean {
if (note.cw != null) {
return false;
}
if (note.text != null) {
if (
note.text.includes('$[x2') ||
note.text.includes('$[x3') ||
note.text.includes('$[x4') ||
note.text.includes('$[scale') ||
note.text.split('\n').length > 9 ||
note.text.length > 500
) {
return true;
}
}
if (urls.length >= 4) {
return true;
}
if (note.files != null && note.files.length >= 5) {
return true;
}
return false;
}