From d857801e038245913e7e81afb3273b4dde626165 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sat, 5 Aug 2023 19:36:51 +0900 Subject: [PATCH 1/7] chore: add way to show renote in window / tab --- packages/frontend/src/components/MkNote.vue | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 6cd1a4c4b5da..d87341248e4a 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -28,10 +28,14 @@ SPDX-License-Identifier: AGPL-3.0-only
- + + + + + + @@ -171,6 +175,7 @@ import { MenuItem } from '@/types/menu'; import MkRippleEffect from '@/components/MkRippleEffect.vue'; import { showMovedDialog } from '@/scripts/show-moved-dialog'; import { shouldCollapsed } from '@/scripts/collapsed'; +import { notePage } from '@/filters/note'; const props = defineProps<{ note: misskey.entities.Note; From e949b53f9188d3ee3cc655121c0b9c88ad2b176f Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sat, 5 Aug 2023 20:48:37 +0900 Subject: [PATCH 2/7] feat: report abuse for renote --- locales/index.d.ts | 1 + locales/ja-JP.yml | 1 + packages/frontend/src/components/MkNote.vue | 39 +++++++++++-------- .../frontend/src/scripts/get-note-menu.ts | 30 ++++++++------ 4 files changed, 42 insertions(+), 29 deletions(-) diff --git a/locales/index.d.ts b/locales/index.d.ts index 4dceec6050ba..aaab4982d0b7 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -657,6 +657,7 @@ export interface Locale { "sample": string; "abuseReports": string; "reportAbuse": string; + "reportAbuseRenote": string; "reportAbuseOf": string; "fillAbuseReportDescription": string; "abuseReported": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index a91b919e6e46..45a77362c01a 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -654,6 +654,7 @@ behavior: "動作" sample: "サンプル" abuseReports: "通報" reportAbuse: "通報" +reportAbuseRenote: "Renoteを通報" reportAbuseOf: "{name}を通報する" fillAbuseReportDescription: "通報理由の詳細を記入してください。対象のノートがある場合はそのURLも記入してください。" abuseReported: "内容が送信されました。ご報告ありがとうございました。" diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index d87341248e4a..757945994d31 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
- @@ -165,7 +165,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, 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'; @@ -430,21 +430,26 @@ 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([{ + 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([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 20cea45ee38f..d26c90494673 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -92,6 +92,20 @@ 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 getNoteMenu(props: { note: misskey.entities.Note; menuButton: Ref; @@ -342,19 +356,11 @@ export function getNoteMenu(props: { }] : [] ),*/ - ...(appearNote.userId !== $i.id ? [ + ...(appearNote.userId !== $i.id || (isRenote && props.note.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, + isRenote && props.note.userId !== $i.id ? getAbuseNoteMenu(props.note, i18n.ts.reportAbuseRenote) : undefined, + ] : [] ), ...(appearNote.userId === $i.id || $i.isModerator || $i.isAdmin ? [ From 8f8b546fe1797b9ab904d014498bf3e062e363c2 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sat, 5 Aug 2023 20:53:04 +0900 Subject: [PATCH 3/7] =?UTF-8?q?docs:=20Renote=E8=87=AA=E4=BD=93=E3=82=92?= =?UTF-8?q?=E9=80=9A=E5=A0=B1=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 457642168da4..36e28195c2b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ - 絵文字ピッカーの検索の表示件数を100件に増加 - Enhance: ユーザーメニューでスイッチでユーザーリストに追加・削除できるように - Enhance: 自分が押したリアクションのデザインを改善 +- Enhance: Renote自体を通報できるように - Fix: サーバー情報画面(`/instance-info/{domain}`)でブロックができないのを修正 - Fix: 未読のお知らせの「わかった」をクリック・タップしてもその場で「わかった」が消えない問題を修正 From f820f767aeae0923a087a6841136df77ec1aea02 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Mon, 21 Aug 2023 22:41:23 +0900 Subject: [PATCH 4/7] revert: make renote time link --- packages/frontend/src/components/MkNote.vue | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 757945994d31..15028f73ccb4 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -28,14 +28,10 @@ SPDX-License-Identifier: AGPL-3.0-only
- - - - - - + @@ -175,7 +171,6 @@ import { MenuItem } from '@/types/menu'; import MkRippleEffect from '@/components/MkRippleEffect.vue'; import { showMovedDialog } from '@/scripts/show-moved-dialog'; import { shouldCollapsed } from '@/scripts/collapsed'; -import { notePage } from '@/filters/note'; const props = defineProps<{ note: misskey.entities.Note; From 1ed632d6d43d9da661ef861c333bb7aa46438257 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Mon, 21 Aug 2023 22:52:50 +0900 Subject: [PATCH 5/7] chore: add copy renote menu --- locales/index.d.ts | 1 + locales/ja-JP.yml | 1 + packages/frontend/src/components/MkNote.vue | 34 ++++++++++++------- .../frontend/src/scripts/get-note-menu.ts | 27 +++++++++------ 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/locales/index.d.ts b/locales/index.d.ts index d34dde40c81e..505fe05d06a9 100644 --- a/locales/index.d.ts +++ b/locales/index.d.ts @@ -48,6 +48,7 @@ export interface Locale { "unpin": string; "copyContent": string; "copyLink": string; + "copyLinkRenote": string; "delete": string; "deleteAndEdit": string; "deleteAndEditConfirm": string; diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 06ca5ac61827..8660f566d1e3 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -45,6 +45,7 @@ pin: "ピン留め" unpin: "ピン留め解除" copyContent: "内容をコピー" copyLink: "リンクをコピー" +copyLinkRenote: "Renoteのリンクをコピー" delete: "削除" deleteAndEdit: "削除して編集" deleteAndEditConfirm: "このノートを削除してもう一度編集しますか?このノートへのリアクション、Renote、返信も全て削除されます。" diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index 15028f73ccb4..fe0c676c4522 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
@@ -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 { getAbuseNoteMenu, 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'; @@ -427,21 +427,29 @@ async function clip() { function showRenoteMenu(viaKeyboard = false): void { if (isMyRenote) { pleaseLogin(); - os.popupMenu([{ - text: i18n.ts.unrenote, - icon: 'ti ti-trash', - danger: true, - action: () => { - os.api('notes/delete', { - noteId: note.id, - }); - isDeleted.value = true; + 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, { + ], renoteTime.value, { viaKeyboard: viaKeyboard, }); } else { - os.popupMenu([getAbuseNoteMenu(note, i18n.ts.reportAbuseRenote)], renoteTime.value, { + os.popupMenu([ + getCopyNoteLinkMenu(note, i18n.ts.copyLinkRenote), + null, + getAbuseNoteMenu(note, i18n.ts.reportAbuseRenote), + ], renoteTime.value, { viaKeyboard: viaKeyboard, }); } diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts index 77ac7f194ad7..62119c646661 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -106,6 +106,17 @@ export function getAbuseNoteMenu(note: misskey.entities.Note, text: string): Men }; } +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; @@ -280,11 +291,9 @@ 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) + , (isRenote ? getCopyNoteLinkMenu(props.note, i18n.ts.copyLinkRenote) : undefined) + , (appearNote.url || appearNote.uri) ? { icon: 'ti ti-external-link', text: i18n.ts.showOnRemote, action: () => { @@ -388,11 +397,9 @@ 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) + , (isRenote ? getCopyNoteLinkMenu(props.note, i18n.ts.copyLinkRenote) : undefined) + , (appearNote.url || appearNote.uri) ? { icon: 'ti ti-external-link', text: i18n.ts.showOnRemote, action: () => { From f08babba655445b356c3c75c0a0c0ec699a8b691 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Tue, 22 Aug 2023 15:12:35 +0900 Subject: [PATCH 6/7] chore: remove copy/report renote from note menu --- packages/frontend/src/scripts/get-note-menu.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts index 62119c646661..d4e737dcf9e4 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -292,7 +292,6 @@ export function getNoteMenu(props: { text: i18n.ts.copyContent, action: copyContent, }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink) - , (isRenote ? getCopyNoteLinkMenu(props.note, i18n.ts.copyLinkRenote) : undefined) , (appearNote.url || appearNote.uri) ? { icon: 'ti ti-external-link', text: i18n.ts.showOnRemote, @@ -368,7 +367,6 @@ export function getNoteMenu(props: { ...(appearNote.userId !== $i.id || (isRenote && props.note.userId !== $i.id) ? [ null, appearNote.userId !== $i.id ? getAbuseNoteMenu(appearNote, i18n.ts.reportAbuse) : undefined, - isRenote && props.note.userId !== $i.id ? getAbuseNoteMenu(props.note, i18n.ts.reportAbuseRenote) : undefined, ] : [] ), @@ -398,7 +396,6 @@ export function getNoteMenu(props: { text: i18n.ts.copyContent, action: copyContent, }, getCopyNoteLinkMenu(appearNote, i18n.ts.copyLink) - , (isRenote ? getCopyNoteLinkMenu(props.note, i18n.ts.copyLinkRenote) : undefined) , (appearNote.url || appearNote.uri) ? { icon: 'ti ti-external-link', text: i18n.ts.showOnRemote, From 14d80b5398af1cbe3081cfaa22aea54eb8e3a04e Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Tue, 22 Aug 2023 15:13:23 +0900 Subject: [PATCH 7/7] fix: abuse menu without actual selection shown --- packages/frontend/src/scripts/get-note-menu.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/scripts/get-note-menu.ts b/packages/frontend/src/scripts/get-note-menu.ts index d4e737dcf9e4..2ec139d410c1 100644 --- a/packages/frontend/src/scripts/get-note-menu.ts +++ b/packages/frontend/src/scripts/get-note-menu.ts @@ -364,7 +364,7 @@ export function getNoteMenu(props: { }] : [] ),*/ - ...(appearNote.userId !== $i.id || (isRenote && props.note.userId !== $i.id) ? [ + ...(appearNote.userId !== $i.id ? [ null, appearNote.userId !== $i.id ? getAbuseNoteMenu(appearNote, i18n.ts.reportAbuse) : undefined, ]