alias cleanup and fixes

This commit is contained in:
or-else
2025-05-09 19:19:02 +03:00
parent 360b37ae13
commit 837013e97c
7 changed files with 83 additions and 58 deletions
+8 -5
View File
@@ -61,17 +61,20 @@ class NewTopicView extends React.Component {
if (!query) {
query = Tinode.DEL_CHAR;
} else if (!/[\s,:]/.test(query) && query != Tinode.DEL_CHAR) {
// No colons, spaces or commas, not DEL char. Try as email or phone.
// If not email or phone, treat as alias.
// No colons, spaces or commas, not DEL char. Try as email, phone, or alias.
const email = asEmail(query);
if (email) {
query = `email:${email}`;
query = `${Tinode.TAG_EMAIL}${email}`;
} else {
const tel = asPhone(query);
if (tel) {
query = `tel:${tel}`;
query = `${Tinode.TAG_PHONE}${tel}`;
} else {
query = `alias:${query}`;
if (query[0] == '@') {
// Strip the leading '@' sign if present.
query = query.substring(1);
}
query = `${Tinode.TAG_ALIAS}${query}`;
}
}
}