Skip to content

Commit

Permalink
enhance(frontend): 検索範囲等が指定されている時は照会/ハッシュタグページを開かないように
Browse files Browse the repository at this point in the history
  • Loading branch information
Sayamame-beans committed May 25, 2024
1 parent a1513dd commit f84eece
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 32 deletions.
34 changes: 18 additions & 16 deletions packages/frontend/src/pages/search.note.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
35 changes: 19 additions & 16 deletions packages/frontend/src/pages/search.user.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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;
return;
}
if (res.type === 'User') {
router.push(`/@${res.object.username}@${res.object.host}`);
} else if (res.type === 'Note') {
router.push(`/notes/${res.object.id}`);
}
if (query.startsWith('#') && query.length > 1) {
router.push(`/user-tags/${encodeURIComponent(query.substring(1))}`);
return;
return;
}
if (query.startsWith('#') && query.length > 1) {
router.push(`/user-tags/${encodeURIComponent(query.substring(1))}`);
return;
}
}
userPagination.value = {
Expand Down

0 comments on commit f84eece

Please sign in to comment.