SHA256
Improve direct message history and SQLite resilience
This commit is contained in:
@@ -2579,6 +2579,23 @@ export class AuthService {
|
||||
};
|
||||
}
|
||||
|
||||
async getDirectMessages({ peerLogin, limit = 50, beforeTimeMs = 0, beforeMessageKey = '' } = {}) {
|
||||
const payload = {
|
||||
peerLogin: String(peerLogin || '').trim(),
|
||||
limit: Number(limit || 0),
|
||||
};
|
||||
if (!payload.peerLogin) throw new Error('Не передан peerLogin');
|
||||
if (Number.isFinite(Number(beforeTimeMs)) && Number(beforeTimeMs) > 0) {
|
||||
payload.beforeTimeMs = Math.trunc(Number(beforeTimeMs));
|
||||
}
|
||||
if (String(beforeMessageKey || '').trim()) {
|
||||
payload.beforeMessageKey = String(beforeMessageKey || '').trim();
|
||||
}
|
||||
const response = await this.ws.request('GetDirectMessages', payload);
|
||||
if (response.status !== 200) throw opError('GetDirectMessages', response);
|
||||
return response.payload || {};
|
||||
}
|
||||
|
||||
async ackSessionDelivery(messageKey) {
|
||||
const response = await this.ws.request('AckSessionDelivery', { messageKey });
|
||||
if (response.status !== 200) throw opError('AckSessionDelivery', response);
|
||||
|
||||
Reference in New Issue
Block a user