This commit is contained in:
syuilo 2024-08-26 13:54:11 +09:00
parent 2edf54b2e3
commit 8a301f8d68
2 changed files with 24 additions and 3 deletions

View File

@ -140,9 +140,8 @@ import { userPage } from '@/utils.js';
import { notePage } from '@/utils.js';
import number from '@/filters/number.js';
import { i18n } from '@/i18n.js';
import { deepClone } from '@/scripts/clone.js';
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
import { shouldCollapsed } from '@/scripts/collapsed.js';
import { shouldCollapsed } from '@/to-be-shared/collapsed.js';
import { instance } from '@/instance.js';
import { url } from '@/config.js';
@ -152,7 +151,7 @@ const props = defineProps<{
const inChannel = inject('inChannel', null);
const note = ref(deepClone(props.note));
const note = ref(props.note);
const isRenote = (
note.value.renote != null &&

View File

@ -0,0 +1,22 @@
/*
* 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 {
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) ||
(urls.length >= 4)
) || note.files.length >= 5
);
return collapsed;
}