From 8d28c16ee10dee1a389dcae095c8a089995fd134 Mon Sep 17 00:00:00 2001 From: Marie Date: Sat, 30 Dec 2023 18:05:09 +0100 Subject: [PATCH] fix: bring back default like setting Seems like due to misskey deleting reaction.vue and making it a new file called emoji-picker.vue caused the default like setting to vanish --- .../src/pages/settings/emoji-picker.vue | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/packages/frontend/src/pages/settings/emoji-picker.vue b/packages/frontend/src/pages/settings/emoji-picker.vue index 1a07790e75..e0a622dc6c 100644 --- a/packages/frontend/src/pages/settings/emoji-picker.vue +++ b/packages/frontend/src/pages/settings/emoji-picker.vue @@ -85,6 +85,17 @@ SPDX-License-Identifier: AGPL-3.0-only + + + + + {{ i18n.ts.notSet }} +
+ Change + Reset +
+
+ @@ -128,6 +139,7 @@ import Sortable from 'vuedraggable'; import MkRadios from '@/components/MkRadios.vue'; import MkButton from '@/components/MkButton.vue'; import FormSection from '@/components/form/section.vue'; +import FromSlot from '@/components/form/slot.vue'; import MkSwitch from '@/components/MkSwitch.vue'; import * as os from '@/os.js'; import { defaultStore } from '@/store.js'; @@ -136,6 +148,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js'; import { deepClone } from '@/scripts/clone.js'; import { reactionPicker } from '@/scripts/reaction-picker.js'; import { emojiPicker } from '@/scripts/emoji-picker.js'; +import { unisonReload } from '@/scripts/unison-reload.js'; import MkCustomEmoji from '@/components/global/MkCustomEmoji.vue'; import MkEmoji from '@/components/global/MkEmoji.vue'; import MkFolder from '@/components/MkFolder.vue'; @@ -152,6 +165,8 @@ const removeReaction = (reaction: string, ev: MouseEvent) => remove(pinnedEmojis const chooseReaction = (ev: MouseEvent) => pickEmoji(pinnedEmojisForReaction, ev); const setDefaultReaction = () => setDefault(pinnedEmojisForReaction); +const like = computed(defaultStore.makeGetterSetter('like')); + const removeEmoji = (reaction: string, ev: MouseEvent) => remove(pinnedEmojis, reaction, ev); const chooseEmoji = (ev: MouseEvent) => pickEmoji(pinnedEmojis, ev); const setDefaultEmoji = () => setDefault(pinnedEmojis); @@ -220,6 +235,30 @@ async function pickEmoji(itemsRef: Ref, ev: MouseEvent) { }); } +async function reloadAsk() { + const { canceled } = await os.confirm({ + type: 'info', + text: i18n.ts.reloadToApplySetting, + }); + if (canceled) return; + + unisonReload(); +} + +function chooseNewLike(ev: MouseEvent) { + os.pickEmoji(getHTMLElement(ev), { + showPinned: false, + }).then(async emoji => { + defaultStore.set('like', emoji as string); + await reloadAsk(); + }); +} + +async function resetLike() { + defaultStore.set('like', null); + await reloadAsk(); +} + function getHTMLElement(ev: MouseEvent): HTMLElement { const target = ev.currentTarget ?? ev.target; return target as HTMLElement;