fix lookup confirmations

having that "lookp user" check *twice* meant that typing a full
username, and then canceling the lookup confirmation, ended up doing a
lookup anyway

now, if you cancel the looup confirmation, you get a search

thanks to @Ares on Discord for reporting
This commit is contained in:
dakkar 2025-02-28 17:45:45 +00:00
parent c19746d9d8
commit 42d6e0deeb

View file

@ -85,19 +85,7 @@ async function search() {
} }
//#endregion //#endregion
if (query.length > 1 && !query.includes(' ')) { if (query.length > 1 && !query.includes(' ') && query.startsWith('#')) {
if (query.startsWith('@')) {
const confirm = await os.confirm({
type: 'info',
text: i18n.ts.lookupConfirm,
});
if (!confirm.canceled) {
router.push(`/${query}`);
return;
}
}
if (query.startsWith('#')) {
const confirm = await os.confirm({ const confirm = await os.confirm({
type: 'info', type: 'info',
text: i18n.ts.openTagPageConfirm, text: i18n.ts.openTagPageConfirm,
@ -107,12 +95,17 @@ async function search() {
return; return;
} }
} }
}
if (query.match(/^@[a-z0-9_.-]+@[a-z0-9_.-]+$/i)) { if (query.match(/^@[a-z0-9_.-]+@[a-z0-9_.-]+$/i)) {
const confirm = await os.confirm({
type: 'info',
text: i18n.ts.lookupConfirm,
});
if (!confirm.canceled) {
router.push(`/${query}`); router.push(`/${query}`);
return; return;
} }
}
userPagination.value = { userPagination.value = {
endpoint: 'users/search', endpoint: 'users/search',