From 363bb43658d7270569ab7ab9f8de158e43719665 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Wed, 29 Nov 2023 22:26:10 +0100 Subject: [PATCH] upd: remove quote button restriction and coloring --- packages/frontend/src/components/MkNote.vue | 35 +------------------ .../src/components/MkNoteDetailed.vue | 32 +---------------- .../frontend/src/components/MkNoteSub.vue | 32 +---------------- 3 files changed, 3 insertions(+), 96 deletions(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 108e78eb07..4da8f16df1 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -127,9 +127,8 @@ SPDX-License-Identifier: AGPL-3.0-only ref="quoteButton" :class="$style.footerButton" class="_button" - :style="quoted ? 'color: var(--accent) !important;' : ''" v-on:click.stop - @mousedown="quoted ? undoQuote(appearNote) : quote()" + @mousedown="quote()" > @@ -281,7 +280,6 @@ const isLong = shouldCollapsed(appearNote, urls ?? []); const collapsed = ref(appearNote.cw == null && isLong); const isDeleted = ref(false); const renoted = ref(false); -const quoted = ref(false); const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false); const translation = ref(null); const translating = ref(false); @@ -367,15 +365,6 @@ if (!props.mock) { }).then((res) => { renoted.value = res.length > 0; }); - - os.api("notes/renotes", { - noteId: appearNote.id, - userId: $i.id, - limit: 1, - quote: true, - }).then((res) => { - quoted.value = res.length > 0; - }); } } @@ -470,7 +459,6 @@ function quote() { os.popup(MkRippleEffect, { x, y }, {}, 'end'); } - quoted.value = res.length > 0; os.toast(i18n.ts.quoted); }); }); @@ -493,7 +481,6 @@ function quote() { os.popup(MkRippleEffect, { x, y }, {}, 'end'); } - quoted.value = res.length > 0; os.toast(i18n.ts.quoted); }); }); @@ -606,26 +593,6 @@ function undoRenote(note) : void { } } -function undoQuote(note) : void { - if (props.mock) { - return; - } - os.api("notes/unrenote", { - noteId: note.id, - quote: true - }); - os.toast(i18n.ts.rmquote); - quoted.value = false; - - const el = quoteButton.value as HTMLElement | null | undefined; - if (el) { - const rect = el.getBoundingClientRect(); - const x = rect.left + (el.offsetWidth / 2); - const y = rect.top + (el.offsetHeight / 2); - os.popup(MkRippleEffect, { x, y }, {}, 'end'); - } -} - function onContextmenu(ev: MouseEvent): void { if (props.mock) { return; diff --git a/packages/frontend/src/components/MkNoteDetailed.vue b/packages/frontend/src/components/MkNoteDetailed.vue index 8fbf6f30a7..4487582562 100644 --- a/packages/frontend/src/components/MkNoteDetailed.vue +++ b/packages/frontend/src/components/MkNoteDetailed.vue @@ -137,8 +137,7 @@ SPDX-License-Identifier: AGPL-3.0-only ref="quoteButton" class="_button" :class="$style.noteFooterButton" - :style="quoted ? 'color: var(--accent) !important;' : ''" - @mousedown="quoted ? undoQuote() : quote()" + @mousedown="quote()" > @@ -310,7 +309,6 @@ const isMyRenote = $i && ($i.id === note.userId); const showContent = ref(false); const isDeleted = ref(false); const renoted = ref(false); -const quoted = ref(false); const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false); const translation = ref(null); const translating = ref(false); @@ -337,15 +335,6 @@ if ($i) { }).then((res) => { renoted.value = res.length > 0; }); - - os.api("notes/renotes", { - noteId: appearNote.id, - userId: $i.id, - limit: 1, - quote: true, - }).then((res) => { - quoted.value = res.length > 0; - }); } const keymap = { @@ -511,7 +500,6 @@ function quote() { os.popup(MkRippleEffect, { x, y }, {}, 'end'); } - quoted.value = res.length > 0; os.toast(i18n.ts.quoted); }); }); @@ -534,7 +522,6 @@ function quote() { os.popup(MkRippleEffect, { x, y }, {}, 'end'); } - quoted.value = res.length > 0; os.toast(i18n.ts.quoted); }); }); @@ -625,23 +612,6 @@ function undoRenote() : void { } } -function undoQuote() : void { - os.api("notes/unrenote", { - noteId: appearNote.id, - quote: true - }); - os.toast(i18n.ts.rmquote); - quoted.value = false; - - const el = quoteButton.value as HTMLElement | null | undefined; - if (el) { - const rect = el.getBoundingClientRect(); - const x = rect.left + (el.offsetWidth / 2); - const y = rect.top + (el.offsetHeight / 2); - os.popup(MkRippleEffect, { x, y }, {}, 'end'); - } -} - function onContextmenu(ev: MouseEvent): void { const isLink = (el: HTMLElement) => { if (el.tagName === 'A') return true; diff --git a/packages/frontend/src/components/MkNoteSub.vue b/packages/frontend/src/components/MkNoteSub.vue index f9d1767ee5..3e33c7aa69 100644 --- a/packages/frontend/src/components/MkNoteSub.vue +++ b/packages/frontend/src/components/MkNoteSub.vue @@ -41,8 +41,7 @@ SPDX-License-Identifier: AGPL-3.0-only ref="quoteButton" class="_button" :class="$style.noteFooterButton" - :style="quoted ? 'color: var(--accent) !important;' : ''" - @mousedown="quoted ? undoQuote() : quote()" + @mousedown="quote()" > @@ -125,7 +124,6 @@ const translation = ref(null); const translating = ref(false); const isDeleted = ref(false); const renoted = ref(false); -const quoted = ref(false); const reactButton = shallowRef(); const renoteButton = shallowRef(); const quoteButton = shallowRef(); @@ -156,15 +154,6 @@ if ($i) { }).then((res) => { renoted.value = res.length > 0; }); - - os.api("notes/renotes", { - noteId: appearNote.id, - userId: $i.id, - limit: 1, - quote: true, - }).then((res) => { - quoted.value = res.length > 0; - }); } function focus() { @@ -255,23 +244,6 @@ function undoRenote() : void { } } -function undoQuote() : void { - os.api("notes/unrenote", { - noteId: appearNote.id, - quote: true - }); - os.toast(i18n.ts.rmquote); - quoted.value = false; - - const el = quoteButton.value as HTMLElement | null | undefined; - if (el) { - const rect = el.getBoundingClientRect(); - const x = rect.left + (el.offsetWidth / 2); - const y = rect.top + (el.offsetHeight / 2); - os.popup(MkRippleEffect, { x, y }, {}, 'end'); - } -} - let showContent = $ref(false); watch(() => props.expandAllCws, (expandAllCws) => { @@ -342,7 +314,6 @@ function quote() { os.popup(MkRippleEffect, { x, y }, {}, 'end'); } - quoted.value = res.length > 0; os.toast(i18n.ts.quoted); }); }); @@ -365,7 +336,6 @@ function quote() { os.popup(MkRippleEffect, { x, y }, {}, 'end'); } - quoted.value = res.length > 0; os.toast(i18n.ts.quoted); }); });