From 645047b7cf2e5a2cd527d239abdcad174d2bb90b Mon Sep 17 00:00:00 2001 From: Johann150 Date: Sun, 29 Oct 2023 20:32:25 +0900 Subject: [PATCH] feat: add "posts with file attached" page to client Co-authored-by: Mia Herkt --- README.md | 1 + locales/de-DE.yml | 2 + locales/en-US.yml | 2 + locales/ja-JP.yml | 2 + .../client/src/components/MkDrive.file.vue | 6 +++ packages/client/src/components/MkTimeline.vue | 6 +++ packages/client/src/pages/attached-files.vue | 39 +++++++++++++++++++ packages/client/src/router.ts | 5 +++ 8 files changed, 63 insertions(+) create mode 100644 packages/client/src/pages/attached-files.vue diff --git a/README.md b/README.md index 7ec59aeff..f29d29df1 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ - 本家 Firefish へのまだマージされていないマージリクエストを独断でマージ - https://git.joinfirefish.org/firefish/firefish/-/merge_requests/10631 + - https://git.joinfirefish.org/firefish/firefish/-/merge_requests/10634 - デフォルトではバイブレーションを無効に - ログインしていなければ投稿検索ができないように - 攻撃対策のため diff --git a/locales/de-DE.yml b/locales/de-DE.yml index 9521870fd..693b521c4 100644 --- a/locales/de-DE.yml +++ b/locales/de-DE.yml @@ -402,6 +402,8 @@ withReplies: "Antworten beinhalten" connectedTo: "Mit folgenden Nutzerkonten verknüpft" notesAndReplies: "Beiträge und Antworten" withFiles: "Beiträge mit Dateien" +attachedToNotes: "Beiträge mit dieser Datei" +showAttachedNotes: "Zeige Beiträge mit dieser Datei" silence: "stummschalten" silenceConfirm: "Sind Sie sicher, dass Sie diesen Benutzer Stummschalten möchten?" unsilence: "Stummschaltung aufheben" diff --git a/locales/en-US.yml b/locales/en-US.yml index 0ec6c823e..033d0a272 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -429,6 +429,8 @@ withReplies: "Include replies" connectedTo: "Following account(s) are connected" notesAndReplies: "Posts and replies" withFiles: "Including files" +attachedToNotes: "Posts with this file" +showAttachedNotes: "Show posts with this file" silence: "Silence" silenceConfirm: "Are you sure that you want to silence this user?" unsilence: "Undo silencing" diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 46a2213b4..45c5b9aca 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -384,6 +384,8 @@ withReplies: "返信を含む" connectedTo: "次のアカウントに接続されています" notesAndReplies: "投稿と返信" withFiles: "ファイル付き" +attachedToNotes: "このファイルが添付された投稿" +showAttachedNotes: "このファイルが添付された投稿を見る" silence: "サイレンス" silenceConfirm: "サイレンスしますか?" unsilence: "サイレンス解除" diff --git a/packages/client/src/components/MkDrive.file.vue b/packages/client/src/components/MkDrive.file.vue index 483375938..5163b9f7c 100644 --- a/packages/client/src/components/MkDrive.file.vue +++ b/packages/client/src/components/MkDrive.file.vue @@ -107,6 +107,12 @@ function getMenu() { icon: `${icon("ph-download-simple")}`, download: props.file.name, }, + { + type: "a", + href: `/my/drive/file/${props.file.id}/attached`, + text: i18n.ts.showAttachedNotes, + icon: `${icon("ph-paperclip")}`, + }, null, { text: i18n.ts.delete, diff --git a/packages/client/src/components/MkTimeline.vue b/packages/client/src/components/MkTimeline.vue index beca720a3..c310851e2 100644 --- a/packages/client/src/components/MkTimeline.vue +++ b/packages/client/src/components/MkTimeline.vue @@ -44,6 +44,7 @@ const props = defineProps<{ antenna?: string; channel?: string; sound?: boolean; + fileId?: string; }>(); const queue = ref(0); @@ -195,6 +196,11 @@ if (props.src === "antenna") { channelId: props.channel, }); connection.on("note", prepend); +} else if (props.src === "file") { + endpoint = "drive/files/attached-notes"; + query = { + fileId: props.fileId, + }; } function closeHint() { diff --git a/packages/client/src/pages/attached-files.vue b/packages/client/src/pages/attached-files.vue new file mode 100644 index 000000000..e0fd09d41 --- /dev/null +++ b/packages/client/src/pages/attached-files.vue @@ -0,0 +1,39 @@ + + + + + diff --git a/packages/client/src/router.ts b/packages/client/src/router.ts index ec8661414..f69cf2a22 100644 --- a/packages/client/src/router.ts +++ b/packages/client/src/router.ts @@ -588,6 +588,11 @@ export const routes = [ component: page(() => import("./pages/drive.vue")), loginRequired: true, }, + { + path: "/my/drive/file/:fileId/attached", + component: page(() => import("./pages/attached-files.vue")), + loginRequired: true, + }, { path: "/my/drive", component: page(() => import("./pages/drive.vue")),