mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-30 17:15:16 +01:00
fix #3781 Add confirm message when account is not found
This commit is contained in:
parent
b36543502b
commit
52e1c7e1fb
@ -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": {
|
||||
|
@ -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)
|
||||
})
|
||||
|
@ -17,6 +17,7 @@
|
||||
</el-header>
|
||||
<el-main class="main">
|
||||
<Status v-if="target() === 'status'" />
|
||||
<Profile v-if="target() === 'account'" />
|
||||
</el-main>
|
||||
</el-container>
|
||||
</template>
|
||||
@ -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()
|
||||
|
12
src/renderer/components/TimelineSpace/Detail/Profile.vue
Normal file
12
src/renderer/components/TimelineSpace/Detail/Profile.vue
Normal file
@ -0,0 +1,12 @@
|
||||
<template></template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'Profile',
|
||||
setup() {}
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
@ -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': {
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue'
|
||||
import { MyWindow } from '~/src/types/global'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'link-preview',
|
||||
@ -36,8 +37,9 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
setup() {
|
||||
const win = (window as any) as MyWindow
|
||||
const openLink = (link: string) => {
|
||||
;(window as any).shell.openExternal(link)
|
||||
win.ipcRenderer.invoke('open-browser', link)
|
||||
}
|
||||
|
||||
return {
|
||||
|
@ -109,6 +109,7 @@ import { usernameWithStyle } from '@/utils/username'
|
||||
import { MUTATION_TYPES as SIDEBAR_MUTATION, ACTION_TYPES as SIDEBAR_ACTION } from '@/store/TimelineSpace/Contents/SideBar'
|
||||
import { ACTION_TYPES as PROFILE_ACTION } from '@/store/TimelineSpace/Contents/SideBar/AccountProfile'
|
||||
import { ACTION_TYPES as DETAIL_ACTION } from '@/store/TimelineSpace/Contents/SideBar/TootDetail'
|
||||
import { MyWindow } from '~/src/types/global'
|
||||
|
||||
export default defineComponent({
|
||||
name: 'status-reaction',
|
||||
@ -143,6 +144,7 @@ export default defineComponent({
|
||||
const store = useStore()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const win = (window as any) as MyWindow
|
||||
const { focused, message, filters, reactionType } = toRefs(props)
|
||||
|
||||
const showContent = ref<boolean>(false)
|
||||
@ -248,7 +250,7 @@ export default defineComponent({
|
||||
const openLink = (e: MouseEvent) => {
|
||||
const link = findLink(e.target as HTMLElement, 'status-reaction')
|
||||
if (link !== null) {
|
||||
return (window as any).shell.openExternal(link)
|
||||
win.ipcRenderer.invoke('open-browser', link)
|
||||
}
|
||||
}
|
||||
const openUser = (account: Entity.Account) => {
|
||||
|
@ -77,7 +77,7 @@
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<Quote
|
||||
v-if="message.quote"
|
||||
v-if="message.quote && message.reblog"
|
||||
:icon="message.reblog.account.avatar"
|
||||
:username="username(message.reblog.account)"
|
||||
:accountName="accountName(message.reblog.account)"
|
||||
@ -145,7 +145,7 @@
|
||||
>
|
||||
<font-awesome-icon icon="bookmark" size="sm" />
|
||||
</el-button>
|
||||
<el-button v-if="quoteSupported" link class="quote-btn" @click="openQuote()">
|
||||
<el-button v-if="quoteSupported" link class="quote-btn" @click="openQuote()" disabled>
|
||||
<font-awesome-icon icon="quote-right" size="sm" />
|
||||
</el-button>
|
||||
<template v-if="server!.sns !== 'mastodon'">
|
||||
@ -239,7 +239,7 @@ import moment from 'moment'
|
||||
import generator, { Entity, MegalodonInterface } from 'megalodon'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { useI18next } from 'vue3-i18next'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useStore } from '@/store'
|
||||
import { Picker, EmojiIndex } from 'emoji-mart-vue-fast/src'
|
||||
import { findAccount, findLink, findTag, ParsedAccount } from '~/src/renderer/utils/tootParser'
|
||||
@ -258,6 +258,7 @@ import { ACTION_TYPES as MUTE_ACTION } from '@/store/TimelineSpace/Modals/MuteCo
|
||||
import { ACTION_TYPES as VIEWER_ACTION } from '@/store/TimelineSpace/Modals/ImageViewer'
|
||||
import { LocalAccount } from '~/src/types/localAccount'
|
||||
import { LocalServer } from '~/src/types/localServer'
|
||||
import { MyWindow } from '~/src/types/global'
|
||||
|
||||
const defaultEmojiIndex = new EmojiIndex(data)
|
||||
|
||||
@ -310,6 +311,7 @@ export default defineComponent({
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const i18n = useI18next()
|
||||
const win = (window as any) as MyWindow
|
||||
const { focused, overlaid, message, filters, account, server } = toRefs(props)
|
||||
const { l, h, r, b, f, o, p, i, x } = useMagicKeys()
|
||||
|
||||
@ -458,7 +460,17 @@ export default defineComponent({
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
openLink(e)
|
||||
ElMessageBox.confirm(
|
||||
i18n.t('cards.toot.open_account.text', { account: parsedAccount.acct }),
|
||||
i18n.t('cards.toot.open_account.title'),
|
||||
{
|
||||
confirmButtonText: i18n.t('cards.toot.open_account.ok'),
|
||||
cancelButtonText: i18n.t('cards.toot.open_account.cancel'),
|
||||
type: 'Warning'
|
||||
}
|
||||
).then(() => {
|
||||
openLink(e)
|
||||
})
|
||||
})
|
||||
return parsedAccount.acct
|
||||
}
|
||||
@ -494,7 +506,7 @@ export default defineComponent({
|
||||
const openLink = (e: MouseEvent) => {
|
||||
const link = findLink(e.target as HTMLElement, 'toot')
|
||||
if (link !== null) {
|
||||
return (window as any).shell.openExternal(link)
|
||||
win.ipcRenderer.invoke('open-browser', link)
|
||||
}
|
||||
}
|
||||
const openReply = () => {
|
||||
@ -507,7 +519,7 @@ export default defineComponent({
|
||||
router.push({ query: { detail: 'true', status_id: message.id } })
|
||||
}
|
||||
const openBrowser = (message: Entity.Status) => {
|
||||
;(window as any).shell.openExternal(message.url)
|
||||
win.ipcRenderer.invoke('open-browser', message.url)
|
||||
}
|
||||
const copyLink = (message: Entity.Status) => {
|
||||
;(window as any).clipboard.writeText(message.url, 'toot-link')
|
||||
|
Loading…
x
Reference in New Issue
Block a user