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 == null || query === '') return;
if (query.startsWith('https://')) { if (!user.value && !isLocalOnly.value) {
const promise = misskeyApi('ap/show', { if (query.startsWith('https://')) {
uri: query, 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') { if (res.type === 'User') {
router.push(`/@${res.object.username}@${res.object.host}`); router.push(`/@${res.object.username}@${res.object.host}`);
} else if (res.type === 'Note') { } else if (res.type === 'Note') {
router.push(`/notes/${res.object.id}`); 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 = { notePagination.value = {

View file

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