1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-11-27 14:28:49 +09:00

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 ## 13.10.3
### Changes ### Changes

View File

@ -56,6 +56,9 @@ import MkFoldableSection from '@/components/MkFoldableSection.vue';
import { $i } from '@/account'; import { $i } from '@/account';
import { instance } from '@/instance'; import { instance } from '@/instance';
import MkInfo from '@/components/MkInfo.vue'; import MkInfo from '@/components/MkInfo.vue';
import { useRouter } from '@/router';
const router = useRouter();
const props = defineProps<{ const props = defineProps<{
query: string; query: string;
@ -84,6 +87,24 @@ async function search() {
if (query == null || query === '') return; 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') { if (tab === 'note') {
notePagination = { notePagination = {
endpoint: 'notes/search', endpoint: 'notes/search',