enhance(frontend): 検索範囲等が指定されている時は照会/ハッシュタグページを開かないように

This commit is contained in:
Sayamame-beans 2024-05-25 11:11:12 +09:00
parent a1513dd0a7
commit f84eecea96
2 changed files with 37 additions and 32 deletions

View File

@ -74,27 +74,29 @@ async function search() {
if (query == null || query === '') return;
if (query.startsWith('https://')) {
const promise = misskeyApi('ap/show', {
uri: query,
});
if (!user.value && !isLocalOnly.value) {
if (query.startsWith('https://')) {
const promise = misskeyApi('ap/show', {
uri: query,
});
os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
const res = await promise;
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}`);
if (res.type === 'User') {
router.push(`/@${res.object.username}@${res.object.host}`);
} else if (res.type === 'Note') {
router.push(`/notes/${res.object.id}`);
}
return;
}
return;
}
if (query.startsWith('#') && query.length > 1) {
router.push(`/tags/${encodeURIComponent(query.substring(1))}`);
return;
if (query.startsWith('#') && query.length > 1) {
router.push(`/tags/${encodeURIComponent(query.substring(1))}`);
return;
}
}
notePagination.value = {

View File

@ -48,27 +48,30 @@ async function search() {
if (query == null || query === '') return;
if (query.startsWith('https://')) {
const promise = misskeyApi('ap/show', {
uri: query,
});
if (searchOrigin.value === 'combined') {
os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
if (query.startsWith('https://')) {
const promise = misskeyApi('ap/show', {
uri: query,
});
const res = await promise;
os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
if (res.type === 'User') {
router.push(`/@${res.object.username}@${res.object.host}`);
} else if (res.type === 'Note') {
router.push(`/notes/${res.object.id}`);
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;
}
return;
}
if (query.startsWith('#') && query.length > 1) {
router.push(`/user-tags/${encodeURIComponent(query.substring(1))}`);
return;
if (query.startsWith('#') && query.length > 1) {
router.push(`/user-tags/${encodeURIComponent(query.substring(1))}`);
return;
}
}
userPagination.value = {