diff options
| author | anatawa12 <anatawa12@icloud.com> | 2023-09-05 17:25:08 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-05 17:25:08 +0900 |
| commit | 46b0eb46b375d2aef9404a4ab75a917f56696768 (patch) | |
| tree | f4ec631c32c87c1ae280156563b653d1488353c2 /packages/frontend | |
| parent | build(deps): bump actions/checkout from 3.6.0 to 4.0.0 (#11786) (diff) | |
| download | misskey-46b0eb46b375d2aef9404a4ab75a917f56696768.tar.gz misskey-46b0eb46b375d2aef9404a4ab75a917f56696768.tar.bz2 misskey-46b0eb46b375d2aef9404a4ab75a917f56696768.zip | |
feat(frontend): Report renote abuse (#11466)
* chore: add way to show renote in window / tab
* feat: report abuse for renote
* docs: Renote自体を通報できるように
* revert: make renote time link
* chore: add copy renote menu
* chore: remove copy/report renote from note menu
* fix: abuse menu without actual selection shown
---------
Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
Diffstat (limited to 'packages/frontend')
| -rw-r--r-- | packages/frontend/src/components/MkNote.vue | 47 | ||||
| -rw-r--r-- | packages/frontend/src/scripts/get-note-menu.ts | 52 |
2 files changed, 61 insertions, 38 deletions
diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 22610b2253..d98a6da0dc 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -29,7 +29,7 @@ SPDX-License-Identifier: AGPL-3.0-only </I18n> <div :class="$style.renoteInfo"> <button ref="renoteTime" :class="$style.renoteTime" class="_button" @click="showRenoteMenu()"> - <i v-if="isMyRenote" class="ti ti-dots" :class="$style.renoteMenu"></i> + <i class="ti ti-dots" :class="$style.renoteMenu"></i> <MkTime :time="note.createdAt"/> </button> <span v-if="note.visibility !== 'public'" style="margin-left: 0.5em;" :title="i18n.ts._visibility[note.visibility]"> @@ -161,7 +161,7 @@ import { reactionPicker } from '@/scripts/reaction-picker'; import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm'; import { $i } from '@/account'; import { i18n } from '@/i18n'; -import { getNoteClipMenu, getNoteMenu } from '@/scripts/get-note-menu'; +import { getAbuseNoteMenu, getCopyNoteLinkMenu, getNoteClipMenu, getNoteMenu } from '@/scripts/get-note-menu'; import { useNoteCapture } from '@/scripts/use-note-capture'; import { deepClone } from '@/scripts/clone'; import { useTooltip } from '@/scripts/use-tooltip'; @@ -425,21 +425,34 @@ async function clip() { } function showRenoteMenu(viaKeyboard = false): void { - if (!isMyRenote) return; - pleaseLogin(); - os.popupMenu([{ - text: i18n.ts.unrenote, - icon: 'ti ti-trash', - danger: true, - action: () => { - os.api('notes/delete', { - noteId: note.id, - }); - isDeleted.value = true; - }, - }], renoteTime.value, { - viaKeyboard: viaKeyboard, - }); + if (isMyRenote) { + pleaseLogin(); + os.popupMenu([ + getCopyNoteLinkMenu(note, i18n.ts.copyLinkRenote), + null, + { + text: i18n.ts.unrenote, + icon: 'ti ti-trash', + danger: true, + action: () => { + os.api('notes/delete', { + noteId: note.id, + }); + isDeleted.value = true; + }, + }, + ], renoteTime.value, { + viaKeyboard: viaKeyboard, + }); + } else { + os.popupMenu([ + getCopyNoteLinkMenu(note, i18n.ts.copyLinkRenote), + null, + getAbuseNoteMenu(note, i18n.ts.reportAbuseRenote), + ], renoteTime.value, { + viaKeyboard: viaKeyboard, + }); + } } function focus() { diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts index 1783abc51a..c8b1cb8dfc 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -92,6 +92,31 @@ export async function getNoteClipMenu(props: { }]; } +export function getAbuseNoteMenu(note: misskey.entities.Note, text: string): MenuItem { + return { + icon: 'ti ti-exclamation-circle', + text, + action: (): void => { + const u = note.url ?? note.uri ?? `${url}/notes/${note.id}`; + os.popup(defineAsyncComponent(() => import('@/components/MkAbuseReportWindow.vue')), { + user: note.user, + initialComment: `Note: ${u}\n-----\n`, + }, {}, 'closed'); + }, + }; +} + +export function getCopyNoteLinkMenu(note: misskey.entities.Note, text: string): MenuItem { + return { + icon: 'ti ti-link', + text, + action: (): void => { + copyToClipboard(`${url}/notes/${note.id}`); + os.success(); + }, + }; +} + export function getNoteMenu(props: { note: Misskey.entities.Note; menuButton: Ref<HTMLElement>; @@ -266,11 +291,8 @@ export function getNoteMenu(props: { icon: 'ti ti-copy', text: i18n.ts.copyContent, action: copyContent, - }, { - icon: 'ti ti-link', - text: i18n.ts.copyLink, - action: copyLink, - }, (appearNote.url || appearNote.uri) ? { + }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink) + , (appearNote.url || appearNote.uri) ? { icon: 'ti ti-external-link', text: i18n.ts.showOnRemote, action: () => { @@ -344,17 +366,8 @@ export function getNoteMenu(props: { ),*/ ...(appearNote.userId !== $i.id ? [ null, - { - icon: 'ti ti-exclamation-circle', - text: i18n.ts.reportAbuse, - action: () => { - const u = appearNote.url ?? appearNote.uri ?? `${url}/notes/${appearNote.id}`; - os.popup(defineAsyncComponent(() => import('@/components/MkAbuseReportWindow.vue')), { - user: appearNote.user, - initialComment: `Note: ${u}\n-----\n`, - }, {}, 'closed'); - }, - }] + appearNote.userId !== $i.id ? getAbuseNoteMenu(appearNote, i18n.ts.reportAbuse) : undefined, + ] : [] ), ...(appearNote.userId === $i.id || $i.isModerator || $i.isAdmin ? [ @@ -382,11 +395,8 @@ export function getNoteMenu(props: { icon: 'ti ti-copy', text: i18n.ts.copyContent, action: copyContent, - }, { - icon: 'ti ti-link', - text: i18n.ts.copyLink, - action: copyLink, - }, (appearNote.url || appearNote.uri) ? { + }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink) + , (appearNote.url || appearNote.uri) ? { icon: 'ti ti-external-link', text: i18n.ts.showOnRemote, action: () => { |