From 2606167f0da856a200d61c0f1cecf0e02844c0f4 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Fri, 7 Jul 2023 20:05:11 +0900 Subject: chore: collapse renote of my note (#11166) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore(frontend): 自分のnoteのrenoteも省略するように Co-authored-by: madorama * docs(changelog): add 見たことのあるRenoteを省略して表示をオンのときに自分のnoteのrenoteを省略するように --------- Co-authored-by: madorama --- packages/frontend/src/components/MkNote.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/frontend/src/components/MkNote.vue') diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 7c9ddadbf8..8fc5e0de5b 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -222,7 +222,7 @@ const translation = ref(null); const translating = ref(false); const showTicker = (defaultStore.state.instanceTicker === 'always') || (defaultStore.state.instanceTicker === 'remote' && appearNote.user.instance); const canRenote = computed(() => ['public', 'home'].includes(appearNote.visibility) || appearNote.userId === $i.id); -let renoteCollapsed = $ref(defaultStore.state.collapseRenotes && isRenote && (($i && ($i.id === note.userId)) || (appearNote.myReaction != null))); +let renoteCollapsed = $ref(defaultStore.state.collapseRenotes && isRenote && (($i && ($i.id === note.userId || $i.id === appearNote.userId)) || (appearNote.myReaction != null))); const keymap = { 'r': () => reply(true), -- cgit v1.2.3-freya From e6db7b9fa74680df94cf3336d7d2dd527c961b63 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Tue, 18 Jul 2023 19:17:17 +0900 Subject: feat(frontend): Renote時に公開範囲のデフォルト設定が適用されるように (#11240) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use saved visibility on renote * chore: use saved localOnly on renote * docs: add comment about why smallerVisibility accepts string * docs(changelog): add Renote時に公開範囲のデフォルト設定が適用されるように --------- Co-authored-by: syuilo --- CHANGELOG.md | 1 + packages/frontend/src/components/MkNote.vue | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) (limited to 'packages/frontend/src/components/MkNote.vue') diff --git a/CHANGELOG.md b/CHANGELOG.md index 5a6de41b86..ec816817c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ - フォローやお気に入り登録をしていないチャンネルを開く時は概要ページを開くように - 画面ビューワをタップした場合、マウスクリックと同様に画像ビューワを閉じるように - オフライン時の画面にリロードボタンを追加 +- Renote時に公開範囲のデフォルト設定が適用されるように - Deckで非ルートページにアクセスした際に簡易UIで表示しない設定を追加 - ロール設定画面でロールIDを確認できるように - コンテキストメニュー表示時のパフォーマンスを改善 diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 8fc5e0de5b..7a7406931b 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -259,6 +259,17 @@ useTooltip(renoteButton, async (showing) => { }, {}, 'closed'); }); +type Visibility = 'public' | 'home' | 'followers' | 'specified'; + +// defaultStore.state.visibilityがstringなためstringも受け付けている +function smallerVisibility(a: Visibility | string, b: Visibility | string): Visibility { + if (a === 'specified' || b === 'specified') return 'specified'; + if (a === 'followers' || b === 'followers') return 'followers'; + if (a === 'home' || b === 'home') return 'home'; + // if (a === 'public' || b === 'public') + return 'public'; +} + function renote(viaKeyboard = false) { pleaseLogin(); showMovedDialog(); @@ -309,7 +320,12 @@ function renote(viaKeyboard = false) { os.popup(MkRippleEffect, { x, y }, {}, 'end'); } + const configuredVisibility = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility; + const localOnly = defaultStore.state.rememberNoteVisibility ? defaultStore.state.localOnly : defaultStore.state.defaultNoteLocalOnly; + os.api('notes/create', { + localOnly, + visibility: smallerVisibility(appearNote.visibility, configuredVisibility), renoteId: appearNote.id, }).then(() => { os.toast(i18n.ts.renoted); -- cgit v1.2.3-freya From a8cd8ed99ecd8b276ac2a08c03fc053419ca55ea Mon Sep 17 00:00:00 2001 From: kabo2468 <28654659+kabo2468@users.noreply.github.com> Date: Fri, 21 Jul 2023 18:58:57 +0900 Subject: enhance: 自動でたたまれる機能が返信先や引用RNにも適用されるように (#10989) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 返信、引用RNでMFMがあったら自動で隠すように * Update CHANGELOG.md * Update MkSubNoteContent.vue * refactor: avoid `Boolean` * docs: update CHANGELOG.md --------- Co-authored-by: Acid Chicken (硫酸鶏) --- CHANGELOG.md | 2 ++ packages/frontend/src/components/MkNote.vue | 13 ++----------- packages/frontend/src/components/MkSubNoteContent.vue | 7 ++----- packages/frontend/src/scripts/collapsed.ts | 19 +++++++++++++++++++ 4 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 packages/frontend/src/scripts/collapsed.ts (limited to 'packages/frontend/src/components/MkNote.vue') diff --git a/CHANGELOG.md b/CHANGELOG.md index 46dd2dd202..438436f01a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,8 @@ - ロール設定画面でロールIDを確認できるように - コンテキストメニュー表示時のパフォーマンスを改善 - フォロー/フォロワー非公開時の表示を改善 +- 本文にMFMが含まれている場合に自動でたたまれる機能が、返信先や引用RNにも適用されるように + - position は対象外になりました - AiScriptを0.15.0に更新 - Fix: サーバーメトリクスが90度傾いている - Fix: 非ログイン時にクレデンシャルが必要なページに行くとエラーが出る問題を修正 diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 7a7406931b..deeae6e940 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -165,6 +165,7 @@ import { getNoteSummary } from '@/scripts/get-note-summary'; import { MenuItem } from '@/types/menu'; import MkRippleEffect from '@/components/MkRippleEffect.vue'; import { showMovedDialog } from '@/scripts/show-moved-dialog'; +import { shouldCollapsed } from '@/scripts/collapsed'; const props = defineProps<{ 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 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 isLong = shouldCollapsed(appearNote); const collapsed = ref(appearNote.cw == null && isLong); const isDeleted = ref(false); const muted = ref(checkWordMute(appearNote, $i, defaultStore.state.mutedWords)); diff --git a/packages/frontend/src/components/MkSubNoteContent.vue b/packages/frontend/src/components/MkSubNoteContent.vue index c76ce7315d..3a032a1167 100644 --- a/packages/frontend/src/components/MkSubNoteContent.vue +++ b/packages/frontend/src/components/MkSubNoteContent.vue @@ -31,16 +31,13 @@ import MkMediaList from '@/components/MkMediaList.vue'; import MkPoll from '@/components/MkPoll.vue'; import { i18n } from '@/i18n'; import { $i } from '@/account'; +import { shouldCollapsed } from '@/scripts/collapsed'; const props = defineProps<{ note: misskey.entities.Note; }>(); -const isLong = - props.note.cw == null && props.note.text != null && ( - (props.note.text.split('\n').length > 9) || - (props.note.text.length > 500) - ); +const isLong = shouldCollapsed(props.note); const collapsed = $ref(isLong); diff --git a/packages/frontend/src/scripts/collapsed.ts b/packages/frontend/src/scripts/collapsed.ts new file mode 100644 index 0000000000..1bf56f233b --- /dev/null +++ b/packages/frontend/src/scripts/collapsed.ts @@ -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; +} -- cgit v1.2.3-freya