enhance(client): 特定のMFM構文を含むノートを省略化するかどうかを選択できる

This commit is contained in:
NoriDev 2023-06-04 04:25:14 +09:00
parent 5d2b521f42
commit fee4b042ca
9 changed files with 22 additions and 8 deletions

View file

@ -61,6 +61,7 @@
- 알림 기본 정렬을 수직으로 변경
- 채팅방 목록 페이지 디자인 개선
- 리노트 문구를 노트 최상단으로 배치
- 특정 MFM 구문이 포함된 노트를 간략화 할지 선택할 수 있음(enhance: [aba0755](https://github.com/kokonect-link/cherrypick/commit/aba0755880d6797f49d34c8b7fe2c602d153e367))
- Fix: (Friendly) 위젯 영역에 safe-area-inset-bottom이 적용되지 않음
- Fix: (Friendly) 플로팅 메뉴를 길게 눌렀을 때 프로필 이미지를 드래그 할 수 있는 문제
- Fix: 위젯 편집 시 헤더 이외의 영역을 눌렀을 때 위젯 설정이 뜨는 문제

View file

@ -1009,6 +1009,7 @@ thisPostMayBeAnnoyingHome: "Post to home timeline"
thisPostMayBeAnnoyingCancel: "Cancel"
thisPostMayBeAnnoyingIgnore: "Post anyway"
collapseRenotes: "Collapse renotes you've already seen"
collapseDefault: "Collapse notes using specific MFM syntax"
internalServerError: "Internal Server Error"
internalServerErrorDescription: "The server has run into an unexpected error."
copyErrorInfo: "Copy error details"

1
locales/index.d.ts vendored
View file

@ -1012,6 +1012,7 @@ export interface Locale {
"thisPostMayBeAnnoyingCancel": string;
"thisPostMayBeAnnoyingIgnore": string;
"collapseRenotes": string;
"collapseDefault": string;
"internalServerError": string;
"internalServerErrorDescription": string;
"copyErrorInfo": string;

View file

@ -1009,6 +1009,7 @@ thisPostMayBeAnnoyingHome: "ホームに投稿"
thisPostMayBeAnnoyingCancel: "やめる"
thisPostMayBeAnnoyingIgnore: "このまま投稿"
collapseRenotes: "見たことのあるRenoteを省略して表示"
collapseDefault: "特定のMFM構文を含むートを省略して表示"
internalServerError: "サーバー内部エラー"
internalServerErrorDescription: "サーバー内部で予期しないエラーが発生しました。"
copyErrorInfo: "エラー情報をコピー"

View file

@ -1010,6 +1010,7 @@ thisPostMayBeAnnoyingHome: "홈에 게시"
thisPostMayBeAnnoyingCancel: "그만두기"
thisPostMayBeAnnoyingIgnore: "이대로 게시"
collapseRenotes: "이미 본 리노트를 간략화하기"
collapseDefault: "특정 MFM 구문이 포함된 노트 간략화하기"
internalServerError: "내부 서버 오류"
internalServerErrorDescription: "내부 서버에서 예기치 않은 오류가 발생했어요."
copyErrorInfo: "오류 정보 복사"

View file

@ -75,10 +75,10 @@
<MkPoll v-if="appearNote.poll" :note="appearNote" :class="$style.poll"/>
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" :class="$style.urlPreview"/>
<div v-if="appearNote.renote" :class="$style.quote"><MkNoteSimple :note="appearNote.renote" :class="$style.quoteNote"/></div>
<button v-if="isLong && collapsed" :class="$style.collapsed" class="_button" @click="collapsed = false">
<button v-if="(isLong || isMFM) && collapsed" :class="$style.collapsed" class="_button" @click="collapsed = false">
<span :class="$style.collapsedLabel">{{ i18n.ts.showMore }}</span>
</button>
<button v-else-if="isLong && !collapsed" :class="$style.showLess" class="_button" @click="collapsed = true">
<button v-else-if="(isLong || isMFM) && !collapsed" :class="$style.showLess" class="_button" @click="collapsed = true">
<span :class="$style.showLessLabel">{{ i18n.ts.showLess }}</span>
</button>
</div>
@ -214,17 +214,19 @@ const isMyRenote = $i && ($i.id === note.userId);
const showContent = ref(false);
const urls = appearNote.text ? extractUrlFromMfm(mfm.parse(appearNote.text)) : null;
const isLong = (appearNote.cw == null && appearNote.text != null && (
(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 isMFM = (appearNote.cw == null && appearNote.text != null && (
(appearNote.text.includes('$[x2')) ||
(appearNote.text.includes('$[x3')) ||
(appearNote.text.includes('$[x4')) ||
(appearNote.text.includes('$[scale')) ||
(appearNote.text.includes('$[position'))
));
const collapsed = ref(appearNote.cw == null && (isLong || isMFM && defaultStore.state.collapseDefault));
const isDeleted = ref(false);
const muted = ref(checkWordMute(appearNote, $i, defaultStore.state.mutedWords));
const translation = ref<any>(null);

View file

@ -37,6 +37,7 @@
<MkSwitch v-model="showClipButtonInNoteFooter">{{ i18n.ts.showClipButtonInNoteFooter }}</MkSwitch>
<MkSwitch v-model="largeNoteReactions">{{ i18n.ts.largeNoteReactions }}</MkSwitch>
<MkSwitch v-model="collapseRenotes">{{ i18n.ts.collapseRenotes }}</MkSwitch>
<MkSwitch v-model="collapseDefault">{{ i18n.ts.collapseDefault }}</MkSwitch>
<MkSwitch v-model="advancedMfm">{{ i18n.ts.enableAdvancedMfm }}</MkSwitch>
<MkSwitch v-if="advancedMfm" v-model="animatedMfm">{{ i18n.ts.enableAnimatedMfm }}</MkSwitch>
<div :class="$style.mfmPreview" class="_panel">
@ -317,6 +318,7 @@ const useEnterToSend = computed(defaultStore.makeGetterSetter('useEnterToSend'))
const postFormVisibilityHotkey = computed(defaultStore.makeGetterSetter('postFormVisibilityHotkey'));
const newNoteRecivedNotificationBehavior = computed(defaultStore.makeGetterSetter('newNoteRecivedNotificationBehavior'));
const fontSize = computed(defaultStore.makeGetterSetter('fontSize'));
const collapseDefault = computed(defaultStore.makeGetterSetter('collapseDefault'));
watch(lang, () => {
miLocalStorage.setItem('lang', lang.value as string);

View file

@ -90,6 +90,7 @@ const defaultStoreSaveKeys: (keyof typeof defaultStore['state'])[] = [
'useEnterToSend',
'postFormVisibilityHotkey',
'newNoteRecivedNotificationBehavior',
'collapseDefault',
];
const coldDeviceStorageSaveKeys: (keyof typeof ColdDeviceStorage.default)[] = [
'lightTheme',

View file

@ -363,6 +363,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device',
default: true,
},
collapseDefault: {
where: 'account',
default: true,
},
}));
// TODO: 他のタブと永続化されたstateを同期