2023-07-27 00:31:52 -05:00
|
|
|
/*
|
2024-02-13 09:59:27 -06:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 00:31:52 -05:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-09-03 23:33:38 -05:00
|
|
|
import * as Misskey from 'misskey-js';
|
2023-07-21 04:58:57 -05:00
|
|
|
|
2023-10-31 20:23:20 -05:00
|
|
|
export function shouldCollapsed(note: Misskey.entities.Note, urls: string[]): boolean {
|
2023-07-21 04:58:57 -05:00
|
|
|
const collapsed = note.cw == null && note.text != null && (
|
|
|
|
(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) ||
|
|
|
|
(note.files.length >= 5) ||
|
2023-10-31 20:23:20 -05:00
|
|
|
(urls.length >= 4)
|
2023-07-21 04:58:57 -05:00
|
|
|
);
|
|
|
|
|
|
|
|
return collapsed;
|
|
|
|
}
|