1f7a81aae7
* update deps
* node16
* wip
* wip
* wip
* Update test-utils.ts
* wip
* Update tsconfig.json
* wip
* Update package.json
* wip
* Update following.vue
* Update followers.vue
* Update index.vue
* Update share.vue
* Update MkUserPopup.vue
* Update MkPostForm.vue
* wip
* Update MkTokenGenerateWindow.vue
* Update MkPagination.vue
* refactor
* update deps
* update deps
* Update sw.ts
* wip
* wip
* wip
* Update FetchInstanceMetadataService.ts
* Update FetchInstanceMetadataService.ts
* update node
* update deps
* 🎨
25 lines
749 B
TypeScript
25 lines
749 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import * as mfm from 'mfm-js';
|
|
import * as Misskey from 'misskey-js';
|
|
import { extractUrlFromMfm } from './extract-url-from-mfm';
|
|
|
|
export function shouldCollapsed(note: Misskey.entities.Note): boolean {
|
|
const urls = note.text ? extractUrlFromMfm(mfm.parse(note.text)) : null;
|
|
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) ||
|
|
(!!urls && urls.length >= 4)
|
|
);
|
|
|
|
return collapsed;
|
|
}
|