From 52e1c7e1fb5823beb891a62d7bf5226f22c991d8 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Mon, 23 Jan 2023 00:52:40 +0900 Subject: [PATCH] fix #3781 Add confirm message when account is not found --- src/config/locales/en/translation.json | 6 +++++ src/main/index.ts | 4 ++++ .../components/TimelineSpace/Detail.vue | 4 +++- .../TimelineSpace/Detail/Profile.vue | 12 ++++++++++ .../components/TimelineSpace/SideMenu.vue | 2 +- .../components/molecules/Toot/LinkPreview.vue | 4 +++- .../organisms/Notification/StatusReaction.vue | 4 +++- src/renderer/components/organisms/Toot.vue | 24 ++++++++++++++----- 8 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 src/renderer/components/TimelineSpace/Detail/Profile.vue diff --git a/src/config/locales/en/translation.json b/src/config/locales/en/translation.json index 565305cb..78ba3220 100644 --- a/src/config/locales/en/translation.json +++ b/src/config/locales/en/translation.json @@ -380,6 +380,12 @@ "until": "until {{datetime}}", "left": "{{datetime}} left", "refresh": "Refresh" + }, + "open_account": { + "title": "Account not found", + "text": "Could not find {{account}} in the server. Do you want to open the account in the browser instead?", + "ok": "Open", + "cancel": "Cancel" } }, "status_loading": { diff --git a/src/main/index.ts b/src/main/index.ts index 1eb46f6e..d45b4597 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -1441,3 +1441,7 @@ ipcMain.on('start-tag-streaming', async (event: IpcMainEvent, obj: TagStreamingO log.error(err) } }) + +ipcMain.handle('open-browser', async (_: IpcMainInvokeEvent, url: string) => { + shell.openExternal(url) +}) diff --git a/src/renderer/components/TimelineSpace/Detail.vue b/src/renderer/components/TimelineSpace/Detail.vue index 31a94481..531ca171 100644 --- a/src/renderer/components/TimelineSpace/Detail.vue +++ b/src/renderer/components/TimelineSpace/Detail.vue @@ -17,6 +17,7 @@ + @@ -25,10 +26,11 @@ import { defineComponent } from 'vue' import { useRoute, useRouter } from 'vue-router' import Status from './Detail/Status.vue' +import Profile from './Detail/Profile.vue' export default defineComponent({ name: 'Detail', - components: { Status }, + components: { Status, Profile }, setup() { const route = useRoute() const router = useRouter() diff --git a/src/renderer/components/TimelineSpace/Detail/Profile.vue b/src/renderer/components/TimelineSpace/Detail/Profile.vue new file mode 100644 index 00000000..1bd01518 --- /dev/null +++ b/src/renderer/components/TimelineSpace/Detail/Profile.vue @@ -0,0 +1,12 @@ + + + + + diff --git a/src/renderer/components/TimelineSpace/SideMenu.vue b/src/renderer/components/TimelineSpace/SideMenu.vue index 16a05b14..adb7fcc8 100644 --- a/src/renderer/components/TimelineSpace/SideMenu.vue +++ b/src/renderer/components/TimelineSpace/SideMenu.vue @@ -372,7 +372,7 @@ export default defineComponent({ break case 'edit': if (account.server) { - ;(window as any).shell.openExternal(account.server.baseURL + '/settings/profile') + win.ipcRenderer.invoke('open-browser', account.server.baseURL + '/settings/profile') } break case 'settings': { diff --git a/src/renderer/components/molecules/Toot/LinkPreview.vue b/src/renderer/components/molecules/Toot/LinkPreview.vue index 273833c1..731e6b05 100644 --- a/src/renderer/components/molecules/Toot/LinkPreview.vue +++ b/src/renderer/components/molecules/Toot/LinkPreview.vue @@ -14,6 +14,7 @@