enhance: 自動でたたまれる機能が返信先や引用RNにも適用されるように (#10989)
* 返信、引用RNでMFMがあったら自動で隠すように * Update CHANGELOG.md * Update MkSubNoteContent.vue * refactor: avoid `Boolean` * docs: update CHANGELOG.md --------- Co-authored-by: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
This commit is contained in:
parent
b3358f0a8b
commit
a8cd8ed99e
|
@ -43,6 +43,8 @@
|
||||||
- ロール設定画面でロールIDを確認できるように
|
- ロール設定画面でロールIDを確認できるように
|
||||||
- コンテキストメニュー表示時のパフォーマンスを改善
|
- コンテキストメニュー表示時のパフォーマンスを改善
|
||||||
- フォロー/フォロワー非公開時の表示を改善
|
- フォロー/フォロワー非公開時の表示を改善
|
||||||
|
- 本文にMFMが含まれている場合に自動でたたまれる機能が、返信先や引用RNにも適用されるように
|
||||||
|
- position は対象外になりました
|
||||||
- AiScriptを0.15.0に更新
|
- AiScriptを0.15.0に更新
|
||||||
- Fix: サーバーメトリクスが90度傾いている
|
- Fix: サーバーメトリクスが90度傾いている
|
||||||
- Fix: 非ログイン時にクレデンシャルが必要なページに行くとエラーが出る問題を修正
|
- Fix: 非ログイン時にクレデンシャルが必要なページに行くとエラーが出る問題を修正
|
||||||
|
|
|
@ -165,6 +165,7 @@ import { getNoteSummary } from '@/scripts/get-note-summary';
|
||||||
import { MenuItem } from '@/types/menu';
|
import { MenuItem } from '@/types/menu';
|
||||||
import MkRippleEffect from '@/components/MkRippleEffect.vue';
|
import MkRippleEffect from '@/components/MkRippleEffect.vue';
|
||||||
import { showMovedDialog } from '@/scripts/show-moved-dialog';
|
import { showMovedDialog } from '@/scripts/show-moved-dialog';
|
||||||
|
import { shouldCollapsed } from '@/scripts/collapsed';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
|
@ -204,17 +205,7 @@ let appearNote = $computed(() => isRenote ? note.renote as misskey.entities.Note
|
||||||
const isMyRenote = $i && ($i.id === note.userId);
|
const isMyRenote = $i && ($i.id === note.userId);
|
||||||
const showContent = ref(false);
|
const showContent = ref(false);
|
||||||
const urls = appearNote.text ? extractUrlFromMfm(mfm.parse(appearNote.text)) : null;
|
const urls = appearNote.text ? extractUrlFromMfm(mfm.parse(appearNote.text)) : null;
|
||||||
const isLong = (appearNote.cw == null && appearNote.text != null && (
|
const isLong = shouldCollapsed(appearNote);
|
||||||
(appearNote.text.includes('$[x2')) ||
|
|
||||||
(appearNote.text.includes('$[x3')) ||
|
|
||||||
(appearNote.text.includes('$[x4')) ||
|
|
||||||
(appearNote.text.includes('$[scale')) ||
|
|
||||||
(appearNote.text.includes('$[position')) ||
|
|
||||||
(appearNote.text.split('\n').length > 9) ||
|
|
||||||
(appearNote.text.length > 500) ||
|
|
||||||
(appearNote.files.length >= 5) ||
|
|
||||||
(urls && urls.length >= 4)
|
|
||||||
));
|
|
||||||
const collapsed = ref(appearNote.cw == null && isLong);
|
const collapsed = ref(appearNote.cw == null && isLong);
|
||||||
const isDeleted = ref(false);
|
const isDeleted = ref(false);
|
||||||
const muted = ref(checkWordMute(appearNote, $i, defaultStore.state.mutedWords));
|
const muted = ref(checkWordMute(appearNote, $i, defaultStore.state.mutedWords));
|
||||||
|
|
|
@ -31,16 +31,13 @@ import MkMediaList from '@/components/MkMediaList.vue';
|
||||||
import MkPoll from '@/components/MkPoll.vue';
|
import MkPoll from '@/components/MkPoll.vue';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { $i } from '@/account';
|
import { $i } from '@/account';
|
||||||
|
import { shouldCollapsed } from '@/scripts/collapsed';
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
note: misskey.entities.Note;
|
note: misskey.entities.Note;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
const isLong =
|
const isLong = shouldCollapsed(props.note);
|
||||||
props.note.cw == null && props.note.text != null && (
|
|
||||||
(props.note.text.split('\n').length > 9) ||
|
|
||||||
(props.note.text.length > 500)
|
|
||||||
);
|
|
||||||
|
|
||||||
const collapsed = $ref(isLong);
|
const collapsed = $ref(isLong);
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
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;
|
||||||
|
}
|
Loading…
Reference in New Issue