chore: use saved visibility on renote

This commit is contained in:
anatawa12 2023-07-11 16:16:14 +09:00
parent b1a297c8e4
commit 353aecc6dd
No known key found for this signature in database
GPG Key ID: 9CA909848B8E4EA6
1 changed files with 13 additions and 0 deletions

View File

@ -259,6 +259,16 @@ useTooltip(renoteButton, async (showing) => {
}, {}, 'closed');
});
type Visibility = 'public' | 'home' | 'followers' | 'specified';
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 +319,10 @@ function renote(viaKeyboard = false) {
os.popup(MkRippleEffect, { x, y }, {}, 'end');
}
const configuredVisibility = defaultStore.state.rememberNoteVisibility ? defaultStore.state.visibility : defaultStore.state.defaultNoteVisibility;
os.api('notes/create', {
visibility: smallerVisibility(appearNote.visibility, configuredVisibility),
renoteId: appearNote.id,
}).then(() => {
os.toast(i18n.ts.renoted);