enhance(client): 検索ページでURLを入力した際に照会したときと同等の挙動をするように

This commit is contained in:
syuilo 2023-03-29 17:22:34 +09:00
parent a529b0e5a3
commit c1d9e23171
2 changed files with 32 additions and 0 deletions

View file

@ -12,6 +12,17 @@
-->
## 13.x.x (unreleased)
### General
-
### Client
- 検索ページでURLを入力した際に照会したときと同等の挙動をするように
### Server
-
## 13.10.3
### Changes

View file

@ -56,6 +56,9 @@ import MkFoldableSection from '@/components/MkFoldableSection.vue';
import { $i } from '@/account';
import { instance } from '@/instance';
import MkInfo from '@/components/MkInfo.vue';
import { useRouter } from '@/router';
const router = useRouter();
const props = defineProps<{
query: string;
@ -84,6 +87,24 @@ async function search() {
if (query == null || query === '') return;
if (query.startsWith('https://')) {
const promise = os.api('ap/show', {
uri: query,
});
os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
const res = await promise;
if (res.type === 'User') {
router.push(`/@${res.object.username}@${res.object.host}`);
} else if (res.type === 'Note') {
router.push(`/notes/${res.object.id}`);
}
return;
}
if (tab === 'note') {
notePagination = {
endpoint: 'notes/search',