Merge origin/main: умный поиск каналов и пользователей

This commit is contained in:
q
2026-10-12 20:14:03 +03:00
28 changed files with 731 additions and 208 deletions
+15
View File
@@ -3206,8 +3206,23 @@ export class AuthService {
return response.payload || {};
}
async searchChannels(query, { limit = 10, ownerLogin = '' } = {}) {
const payload = { query, limit };
if (ownerLogin) payload.ownerLogin = ownerLogin;
const response = await this.ws.request('SearchChannels', payload);
if (response.status !== 200) throw opError('SearchChannels', response);
return Array.isArray(response.payload?.channels) ? response.payload.channels : [];
}
async searchPeople(query, { limit = 10 } = {}) {
const response = await this.ws.request('SearchUsers', { prefix: query, limit });
if (response.status !== 200) throw opError('SearchUsers', response);
return Array.isArray(response.payload?.users) ? response.payload.users : [];
}
async searchUsers(prefix, options = {}) {
const payload = { prefix };
if (Number.isInteger(options?.limit)) payload.limit = options.limit;
if (typeof options?.isServer === 'boolean') {
payload.isServer = options.isServer;
}