Handle t.me/username as username in search
This commit is contained in:
parent
b15c51d5d1
commit
da405f647d
@ -910,6 +910,18 @@ export class AppUsersManager {
|
|||||||
});
|
});
|
||||||
} */
|
} */
|
||||||
public searchContacts(query: string, limit = 20) {
|
public searchContacts(query: string, limit = 20) {
|
||||||
|
// handle 't.me/username' as 'username'
|
||||||
|
const entities = RichTextProcessor.parseEntities(query);
|
||||||
|
if(entities.length && entities[0].length === query.trim().length && entities[0]._ === 'messageEntityUrl') {
|
||||||
|
try {
|
||||||
|
const url = new URL(RichTextProcessor.wrapUrl(query).url);
|
||||||
|
const path = url.pathname.slice(1);
|
||||||
|
if(path) {
|
||||||
|
query = path;
|
||||||
|
}
|
||||||
|
} catch(err) {}
|
||||||
|
}
|
||||||
|
|
||||||
return apiManager.invokeApiCacheable('contacts.search', {
|
return apiManager.invokeApiCacheable('contacts.search', {
|
||||||
q: query,
|
q: query,
|
||||||
limit
|
limit
|
||||||
|
Loading…
x
Reference in New Issue
Block a user