From d2f1f6f4c04582476f3da5251ac208d409d2d00c Mon Sep 17 00:00:00 2001 From: Freeplay Date: Fri, 12 May 2023 21:48:58 -0400 Subject: [PATCH] Only show mfm warning the first time + fix sparkle --- .../client/src/components/MkSubNoteContent.vue | 14 +++++++++----- packages/client/src/components/mfm.ts | 2 +- packages/client/src/store.ts | 4 ++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/client/src/components/MkSubNoteContent.vue b/packages/client/src/components/MkSubNoteContent.vue index 6a7a8fa42..1df2e7279 100644 --- a/packages/client/src/components/MkSubNoteContent.vue +++ b/packages/client/src/components/MkSubNoteContent.vue @@ -187,11 +187,15 @@ let disableMfm = $ref(hasMfm && defaultStore.state.animatedMfm); async function toggleMfm() { if (disableMfm) { - const { canceled } = await os.confirm({ - type: "warning", - text: i18n.ts._mfm.warn, - }); - if (canceled) return; + if (!defaultStore.state.animatedMfmWarnShown) { + const { canceled } = await os.confirm({ + type: "warning", + text: i18n.ts._mfm.warn, + }); + if (canceled) return; + + defaultStore.set("animatedMfmWarnShown", true); + } disableMfm = false; } else { diff --git a/packages/client/src/components/mfm.ts b/packages/client/src/components/mfm.ts index 67147cdb2..7e3c14335 100644 --- a/packages/client/src/components/mfm.ts +++ b/packages/client/src/components/mfm.ts @@ -151,7 +151,7 @@ export default defineComponent({ break; } case "sparkle": { - if (!(defaultStore.state.animatedMfm || reducedMotion())) { + if (reducedMotion()) { return genEl(token.children); } return h(MkSparkle, {}, genEl(token.children)); diff --git a/packages/client/src/store.ts b/packages/client/src/store.ts index b4e10d275..adebb1c49 100644 --- a/packages/client/src/store.ts +++ b/packages/client/src/store.ts @@ -158,6 +158,10 @@ export const defaultStore = markRaw( where: "device", default: true, }, + animatedMfmWarnShown: { + where: "device", + default: false, + }, loadRawImages: { where: "device", default: false,