diff options
| author | anatawa12 <anatawa12@icloud.com> | 2023-07-18 19:17:17 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-18 19:17:17 +0900 |
| commit | e6db7b9fa74680df94cf3336d7d2dd527c961b63 (patch) | |
| tree | 1d6fdebfc5551bcc89bc88bdf61f3e2656b83d8d /packages/frontend/src/components/MkNote.vue | |
| parent | New Crowdin updates (#11304) (diff) | |
| download | misskey-e6db7b9fa74680df94cf3336d7d2dd527c961b63.tar.gz misskey-e6db7b9fa74680df94cf3336d7d2dd527c961b63.tar.bz2 misskey-e6db7b9fa74680df94cf3336d7d2dd527c961b63.zip | |
feat(frontend): Renote時に公開範囲のデフォルト設定が適用されるように (#11240)
* 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 <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/frontend/src/components/MkNote.vue')
| -rw-r--r-- | packages/frontend/src/components/MkNote.vue | 16 |
1 files changed, 16 insertions, 0 deletions
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); |