Исправлен ReferenceError chatId в chat-view при отправке read-receipt
This commit is contained in:
parent
cc59bd18ee
commit
bec1d08757
@ -193,37 +193,37 @@ export function render({ navigate, route }) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
renderLog(log, chatId);
|
renderLog(log, chatId);
|
||||||
void sendReadReceiptsForVisible();
|
void sendReadReceiptsForVisible(chatId);
|
||||||
wrap.append(log, form);
|
wrap.append(log, form);
|
||||||
screen.append(wrap);
|
screen.append(wrap);
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
async function sendReadReceiptsForVisible() {
|
async function sendReadReceiptsForVisible(chatId) {
|
||||||
const pending = getChatMessages(chatId)
|
const pending = getChatMessages(chatId)
|
||||||
.filter((row) => row?.from === 'in' && Number(row?.messageType) === 1 && !row?.readReceiptSent)
|
.filter((row) => row?.from === 'in' && Number(row?.messageType) === 1 && !row?.readReceiptSent)
|
||||||
.slice(0, 50);
|
.slice(0, 50);
|
||||||
for (const row of pending) {
|
for (const row of pending) {
|
||||||
const ref = parseBaseKey(row.baseKey);
|
const ref = parseBaseKey(row.baseKey);
|
||||||
if (!ref) continue;
|
if (!ref) continue;
|
||||||
try {
|
try {
|
||||||
await authService.sendReadReceipt({
|
await authService.sendReadReceipt({
|
||||||
login: state.session.login,
|
login: state.session.login,
|
||||||
toLogin: ref.fromLogin,
|
toLogin: ref.fromLogin,
|
||||||
storagePwd: state.session.storagePwdInMemory,
|
storagePwd: state.session.storagePwdInMemory,
|
||||||
refToLogin: ref.toLogin,
|
refToLogin: ref.toLogin,
|
||||||
refFromLogin: ref.fromLogin,
|
refFromLogin: ref.fromLogin,
|
||||||
refTimeMs: ref.timeMs,
|
refTimeMs: ref.timeMs,
|
||||||
refNonce: ref.nonce,
|
refNonce: ref.nonce,
|
||||||
refType: 1,
|
refType: 1,
|
||||||
});
|
});
|
||||||
row.readReceiptSent = true;
|
row.readReceiptSent = true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
addAppLogEntry({
|
addAppLogEntry({
|
||||||
level: 'warn',
|
level: 'warn',
|
||||||
source: 'read-receipt',
|
source: 'read-receipt',
|
||||||
message: 'Не удалось отправить подтверждение прочтения',
|
message: 'Не удалось отправить подтверждение прочтения',
|
||||||
details: { chatId, messageKey: row.messageKey || '', error: e?.message || 'unknown' },
|
details: { chatId, messageKey: row.messageKey || '', error: e?.message || 'unknown' },
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user