more robust "only one renote at a time" logic

this blocks the button as well, not just the hotkey
This commit is contained in:
dakkar 2024-06-12 17:28:14 +01:00
parent f98229d3e0
commit 935cb73c0b
4 changed files with 20 additions and 4 deletions

View file

@ -336,7 +336,7 @@ let renoting = false;
const keymap = { const keymap = {
'r': () => reply(true), 'r': () => reply(true),
'e|a|plus': () => react(true), 'e|a|plus': () => react(true),
'(q)': () => { if (canRenote.value && !renoted.value && !renoting) { renoting = true; renote(appearNote.value.visibility); } }, '(q)': () => { if (canRenote.value && !renoted.value && !renoting) renote(appearNote.value.visibility); },
'up|k|shift+tab': focusBefore, 'up|k|shift+tab': focusBefore,
'down|j|tab': focusAfter, 'down|j|tab': focusAfter,
'esc': blur, 'esc': blur,
@ -414,6 +414,8 @@ if (!props.mock) {
} }
function boostVisibility() { function boostVisibility() {
if (renoting) return;
if (!defaultStore.state.showVisibilitySelectorOnBoost) { if (!defaultStore.state.showVisibilitySelectorOnBoost) {
renote(defaultStore.state.visibilityOnBoost); renote(defaultStore.state.visibilityOnBoost);
} else { } else {
@ -425,6 +427,8 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
pleaseLogin(); pleaseLogin();
showMovedDialog(); showMovedDialog();
renoting = true;
if (appearNote.value.channel) { if (appearNote.value.channel) {
const el = renoteButton.value as HTMLElement | null | undefined; const el = renoteButton.value as HTMLElement | null | undefined;
if (el) { if (el) {

View file

@ -342,7 +342,7 @@ let renoting = false;
const keymap = { const keymap = {
'r': () => reply(true), 'r': () => reply(true),
'e|a|plus': () => react(true), 'e|a|plus': () => react(true),
'(q)': () => { if (canRenote.value && !renoted.value && !renoting) { renoting = true; renote(appearNote.value.visibility); } }, '(q)': () => { if (canRenote.value && !renoted.value && !renoting) renote(appearNote.value.visibility); },
'esc': blur, 'esc': blur,
'm|o': () => showMenu(true), 'm|o': () => showMenu(true),
's': () => showContent.value !== showContent.value, 's': () => showContent.value !== showContent.value,
@ -434,6 +434,8 @@ useTooltip(quoteButton, async (showing) => {
}); });
function boostVisibility() { function boostVisibility() {
if (renoting) return;
if (!defaultStore.state.showVisibilitySelectorOnBoost) { if (!defaultStore.state.showVisibilitySelectorOnBoost) {
renote(defaultStore.state.visibilityOnBoost); renote(defaultStore.state.visibilityOnBoost);
} else { } else {
@ -445,6 +447,8 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
pleaseLogin(); pleaseLogin();
showMovedDialog(); showMovedDialog();
renoting = true;
if (appearNote.value.channel) { if (appearNote.value.channel) {
const el = renoteButton.value as HTMLElement | null | undefined; const el = renoteButton.value as HTMLElement | null | undefined;
if (el) { if (el) {

View file

@ -335,7 +335,7 @@ let renoting = false;
const keymap = { const keymap = {
'r': () => reply(true), 'r': () => reply(true),
'e|a|plus': () => react(true), 'e|a|plus': () => react(true),
'(q)': () => { if (canRenote.value && !renoted.value && !renoting) { renoting = true; renote(appearNote.value.visibility); } }, '(q)': () => { if (canRenote.value && !renoted.value && !renoting) renote(appearNote.value.visibility); },
'up|k|shift+tab': focusBefore, 'up|k|shift+tab': focusBefore,
'down|j|tab': focusAfter, 'down|j|tab': focusAfter,
'esc': blur, 'esc': blur,
@ -413,6 +413,8 @@ if (!props.mock) {
} }
function boostVisibility() { function boostVisibility() {
if (renoting) return;
if (!defaultStore.state.showVisibilitySelectorOnBoost) { if (!defaultStore.state.showVisibilitySelectorOnBoost) {
renote(defaultStore.state.visibilityOnBoost); renote(defaultStore.state.visibilityOnBoost);
} else { } else {
@ -424,6 +426,8 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
pleaseLogin(); pleaseLogin();
showMovedDialog(); showMovedDialog();
renoting = true;
if (appearNote.value.channel) { if (appearNote.value.channel) {
const el = renoteButton.value as HTMLElement | null | undefined; const el = renoteButton.value as HTMLElement | null | undefined;
if (el) { if (el) {

View file

@ -351,7 +351,7 @@ let renoting = false;
const keymap = { const keymap = {
'r': () => reply(true), 'r': () => reply(true),
'e|a|plus': () => react(true), 'e|a|plus': () => react(true),
'(q)': () => { if (canRenote.value && !renoted.value && !renoting) { renoting = true; renote(appearNote.value.visibility); } }, '(q)': () => { if (canRenote.value && !renoted.value && !renoting) renote(appearNote.value.visibility); },
'esc': blur, 'esc': blur,
'm|o': () => showMenu(true), 'm|o': () => showMenu(true),
's': () => showContent.value !== showContent.value, 's': () => showContent.value !== showContent.value,
@ -443,6 +443,8 @@ useTooltip(quoteButton, async (showing) => {
}); });
function boostVisibility() { function boostVisibility() {
if (renoting) return;
if (!defaultStore.state.showVisibilitySelectorOnBoost) { if (!defaultStore.state.showVisibilitySelectorOnBoost) {
renote(defaultStore.state.visibilityOnBoost); renote(defaultStore.state.visibilityOnBoost);
} else { } else {
@ -454,6 +456,8 @@ function renote(visibility: Visibility, localOnly: boolean = false) {
pleaseLogin(); pleaseLogin();
showMovedDialog(); showMovedDialog();
renoting = true;
if (appearNote.value.channel) { if (appearNote.value.channel) {
const el = renoteButton.value as HTMLElement | null | undefined; const el = renoteButton.value as HTMLElement | null | undefined;
if (el) { if (el) {